The accessibility identifier is a developer generated ID for GUI objects, which can be used for automation tests.
A UIBarButtonItem
does not implement
If you have UIToolbar
created inside that if you want to create multiple UIBarButtonItem
programatically then it can be accessed like that and set accessibilityLabel
as well like that below:-
-(void)viewDidAppear:(BOOL)animated
{
UIBarButtonItem *infoButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"info" style:UIBarButtonItemStyleBordered target:self action:@selector(infoButtonClicked)];
[self.customToolBar setItems:[NSArray arrayWithObject:infoButtonItem]];
//Here if you have muliple you can loop through it
UIView *view = (UIView*)[self.customToolBar.items objectAtIndex:0];
[view setAccessibilityLabel:NSLocalizedString(@"Test", @"")];
}