5

I am trying to find a way to customise the accessibility label for the back button on the navigation bar for voiceover feature. I know the accessibilityLabel feature is used to customise the elements, however I can't seem to be able to do it for the navigation bar's back button. Any advice on how I should approach this issue?

I am developing on iOS 8, using Swift.

Cherie CH.
  • 171
  • 2
  • 8

2 Answers2

5

No, you cannot use any other than accessibilityLabel to set the accessibilityLabel for an element. Your other otpion is setting the accessibilityHint. But you should always set the accessibilityLabel.

You can set the accessibility for the back button as:

You can customise your accessibilityLabel string but not accessibilityLabel.

Obj-C:

[self.navigationController.navigationBar.backItem setAccessibilityLabel:@"your string"];

Swift:

self.navigationController.navigationBar.backItem.setAccessibilityLabel("your string")

Swift 2.2

self.navigationController?.navigationBar.backItem?.accessibilityLabel = "your string"

You can also change the traits for an element.for that look into UIAccessibilityTraits

Samy
  • 1,172
  • 9
  • 13
Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
0

You first go to the view controller to which this navigation controller is attached or embedded. Click on the top bar in view controller in storyboard, you will see options, in which there is one for back button click on that and you can change it to anything you want.

Mukesh Thawani
  • 316
  • 5
  • 12