开发者

UIATableView Always Named "Empty list"

开发者 https://www.devze.com 2023-03-13 07:43 出处:网络
I\'m trying to set up some UIAutomation tests on the iPhone.Whenever I execute logElementTree() on the main window, all of my UIATableView elements have the name \"Empty list.\"I have tried setting th

I'm trying to set up some UIAutomation tests on the iPhone. Whenever I execute logElementTree() on the main window, all of my UIATableView elements have the name "Empty list." I have tried setting the name in the corresponding XIB file, but once data is loaded, the name is set to "Empty list" again. The below is an example of output from invoking logElementTree():

 4) UIATableView [name:Empty list value:rows 1 to 1 of 1 rect:{{x:0, y:64}, {width:320, height:416}}]
 5) UIATableCell [n开发者_运维技巧ame:OfferCardTableViewCell value:(null) rect:{{x:0, y:160}, {width:320, height:416}}]
 6) UIAWebView [name:(null) value:(null) rect:{{x:0, y:160}, {width:320, height:418}}]
 6) UIAWebView [name:(null) value:(null) rect:{{x:320, y:160}, {width:320, height:418}}]
 6) UIAWebView [name:(null) value:(null) rect:{{x:640, y:160}, {width:320, height:418}}]

As you can see, the table view is not empty. Does anyone know how I can ensure that the UIATableView element is given a name other than "Empty list?" Is there a delegate that I am not implementing somewhere?


You want to set an accessibilityLabel for the UITableView. In Xcode 4 at least, you can't set this property in Interface Builder -- so you will have to do it programatically.


The element name is derived from the accessibility attribute of the underlying view. If an identifier attribute string is specified, that string is used as the name; otherwise, the label attribute string is used as the name. Contrast with the label method.

Don't use accessibility label to identify elements, use accessibility identifier.

In interface builder, the identifier can be set using runtime attributes:

open Identity Inspector - User Defined Runtime Attributes:

Key Path: accessibilityIdentifier
Type: String
Value: <your identifier>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号