Set the accessibility attributes on UIBarButtonItem

Viewed 17899

I have several UIBarButtonItem objects in Interface Builder, and I cannot find any option to set the accessibility label or hint for these buttons.

How can I set these attributes?

8 Answers

Trying to set accessibility labels manually didn't work for me with UIBarButtonItem images. However, if I set the title manually then the label would work. But it displays the title below the image.

I ended up creating an UIButton and using it as a custom view for the UIBarButtonItem. The only loss being the image masking that UIBarButtonItem performs. Added bonus: accessibility configurable in IB.

In Xcode 10.2, the Title field works well. Here, for example, my button is accessible as "Sort":

enter image description here

Related