2

I have a tabbar application. If there is a badge on a certain tab VoiceOver pronounces N items. I'd like to make it pronounce N messages.

How do I do that?

César
  • 9,939
  • 6
  • 53
  • 74
yulia_samoylova
  • 51
  • 1
  • 1
  • 3

1 Answers1

0

I had a similar problem, it seems that UITabBarViewController.tabbar is handling accessibility differently than other views. So my solution was placing another uiview above the badge as a subview of [tabbar superview] and adding accessibility to this view:

At viewDidLoad:

self.badgeAccessibilityView = [[UIView alloc] init];
//use tabBarView.frame to calculate
self.badgeAccessibilityView.frame = frameAccordingToBadgeLocation;
self.badgeAccessibilityView.userInteractionEnabled = YES;
self.badgeAccessibilityView.isAccessibilityElement = YES;
[self.tabBarView.superview addSubview:self.badgeAccessibilityView];

On badge value change:

self.badgeAccessibilityView.accessibilityLabel = 
   [NSString stringWithFormat:@"%d Notifications", badgeValue];
Avishay Cohen
  • 2,418
  • 1
  • 22
  • 40