I found out, that even though I could set accessibilityLabel
of UISegmentedControl
's segment (see: How do I set the accesibility label for a particular segment of a UISegmentedControl?), I couldn't set accessibilityIdentifier
, which was equally important for my project. I need to target a segment irrespective of its text and accessibilityLabel
for automation purposes.
For example, the code:
NSString *name = [NSString stringWithFormat:@"Item %li", (long)idx];
segment.accessibilityIdentifier = name;
NSLog(@"ID: %@", segment.accessibilityIdentifier);
results in:
ID: (null)
No exceptions are thrown.
Does anybody have insight into why accessibilityLabel
is implemented, but not accessibilityIdentifier
?