iphone - Cant access TableViewCell elements using UI Automation -
i have custom table view cell displays details of conference call. body of cell's constructor below:
- (id)initwithframe:(cgrect)frame reuseidentifier:(nsstring*) reuseidentifier { if(self = [super initwithstyle:uitableviewcellstyledefault reuseidentifier:reuseidentifier]) { self.contentview.isaccessibilityelement = yes; self.contentview.accessibilitylabel = @"blah"; conferencenamelabel = [[uilabel alloc] initwithframe:cgrectzero]; conferencenamelabel.adjustsfontsizetofitwidth = yes; conferencenamelabel.font = [uifont systemfontofsize:14]; conferencenamelabel.isaccessibilityelement = yes; conferencenamelabel.accessibilitylabel = @"name"; [self.contentview addsubview:conferencenamelabel]; conferencedatelabel = [[uilabel alloc] initwithframe:cgrectzero]; conferencedatelabel.adjustsfontsizetofitwidth = yes; conferencedatelabel.font = [uifont systemfontofsize:14]; conferencedatelabel.isaccessibilityelement = yes; conferencedatelabel.accessibilitylabel = @"date"; [self.contentview addsubview:conferencedatelabel]; recurringiconview = [[uiimageview alloc] initwithframe:cgrectzero]; [recurringiconview setcontentmode:uiviewcontentmodescaleaspectfit]; recurringiconview.isaccessibilityelement = yes; recurringiconview.accessibilitylabel = @"icon"; [self.contentview addsubview:recurringiconview]; [self setaccessorytype:uitableviewcellaccessorydisclosureindicator]; } return self; }
when using ui automation, can access content view using accessibility label "blah". cant access of labels or imageview. reason why can't @ ui elements using ui automation?
within script, should able log out accessibility hierarchy each cell using logelementtree():
cell.logelementtree(); these subview should appear in logged tree, along accessibility labels.
if somehow can't address these elements label, should able grab them relative position in list of sibling views:
var firstlabel = cell.elements()[0]; i walk through ui automation , show examples of how test out table views in course on itunes u.
Comments
Post a Comment