4

Brent Simmons wrote in a blog post that tap gesture recognizers, presumably on a UIView, are less accessible than UIButtons. I'm trying to learn my way around making my app accessible, and I was curious if anyone could clarify what makes that less accessible than a UIButton, and what makes an element "accessible" to begin with?

For more customizability I was planning to build a button comprised of a UIView and tap gesture recognizers with some subviews, but now I'm not so sure. Is it possible to make a UIView as accessible as a UIButton?

Doug Smith
  • 29,668
  • 57
  • 204
  • 388

1 Answers1

2

Accessible in this context most likely refers to UI elements that can be used using Apple's accessibility features, such as VoiceOver (see example below).

For example, a visually impaired person will not be able to see your view or subviews, or buttons for that matter; but the accessibility software "VoiceOver" built into every iOS device will read to her/him the kind of object and its title, something like "Button: Continue" (if the button title is "Continue").

You can see that most likely the tap gesture recognizer will not be read by VoiceOver and thus be less "accessible".

Mundi
  • 79,884
  • 17
  • 117
  • 140
  • I believe you can annotate every object for accessibility, so you could include instructions for the taps as well. But I would recommend to stick with standard UI elements. – Mundi Oct 27 '14 at 00:47
  • 1
    You can give the custom element the "button" `accessibilityTrait` (a bit mask), which the button already has by default. This will read "button" after the accessibilityLabel. You should _not_ add the word "button" to your label. – David Rönnqvist Oct 27 '14 at 07:23
  • 1
    Furthermore, VoiceOver can activate views masquerading as buttons that use gesture recognizers to detect single taps. VoiceOver will synthesize a tap at the view's `accessibilityActivationPoint`, a property that is customizable, but defaults to the center point. – Justin Oct 27 '14 at 16:52