Search code examples
iosuinavigationbaruibarbuttonitemvoiceover

Voiceover overriding for UIbarButtonItem


I am trying to do custom voice over for UIBarButtonItem . Although it is reading the accessibilityValue it is also reading the name of the image set for UIBarButtonItem.

sidebarButton = [[UIBarButtonItem alloc] init];
sidebarButton.image = [[UIImage imageNamed:@"menu.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
sidebarButton.isAccessibilityElement = YES;
[sidebarButton setAccessibilityValue:@"Checking Something"];

So the voiceover is reading "Menu Checking Something Button". Although I want it to read only "Checking Something".

Note Disabling accessiblity for image doesn't work. sidebarButton.image.isAccessibilityElement = NO;


Solution

  • Using setAccessibilityLabel instead of setAccessibilityValue solves the problem