2

In our iOS app, we have a screen with a UINavigationController, three UIBarButtonItem in the rightBarButtonItems, a UIView content view with a UITableView subview.

Every time the app gets to the foreground, VoiceOver places the initial focus on the leftmost UIBarButtonItem. We would like to have the focus on either the topmost cell in the UITableView (initial start) or the cell that the user actively selected before the app went to the background.

We have tried to call UIAccessibilityPostNotification() but this only works if we add a delay and that seems very fragile and will be confusing for the user as focus will start on the UIBarButtonItem and then jump.

Nicolai Henriksen
  • 1,324
  • 1
  • 13
  • 37

2 Answers2

3

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.75*Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, self.view) }

This might work.

logesh mb
  • 31
  • 6
0

As far as I know uiaccessibilitypostnotification works well with the delay, even though it is fragile, you can call the method with 0.5 seconds delay in the view did appear method!!!!

There is also another way you can try. Once the view is loaded, disable the accessibility for the bar buttons, and set the accessibility only for the tableview!!! You need to change the accessibilityElements array and the first element in the array should be the table view, and set isAccessibilityElemnt to NO for the other elements to turn off the accessibility!!!!

Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
  • I like the "disable accessibility for the bar buttons" idea a little better. Although the problem is there every time the app enters foreground so I guess I need to listen for that notification. – Nicolai Henriksen Nov 26 '15 at 08:47