Learnings for Accessibility for iOS Platform


Published on

This presentation provides an overview on what it means to make an app accessible for the iOS platform. It provides guidelines for making your iOS app accessible and includes an overview on the most common accessible attributes, traits and how to add Accessibility via interface builder as well as in code. It covers Accessibility Notifications, Voiceover specific API, Accessibility Containers, and some of the best practices for Accessibility.

Published in: Technology, Design

Learnings for Accessibility for iOS Platform

  1. 1. people Learnings for Accessibility Tasneem Sayeed June 6, 2013
  2. 2. Agenda • Accessibility – What it means for an iOS developer – How do I make my app accessible • Accessibility Attributes & Traits • Adding Accessibility – via Interface Builder – In Code • Accessibility Notifications • VoiceOver specific API • Scrollable Elements • Accessibility Containers • Best Practices for Accessibility • Summary
  3. 3. • Making Your App Accessible – The iOS Human Interface Guidelines provide detailed instructions on how to create an intuitive interface that enables users with disabilities to accomplish tasks quickly and efficiently, while maintaining the consistency and ease of learning that characterizes successful iOS apps. – Developers that use standard controls and their subclasses will find that support for accessibility is built-in. Apple’s Accessibility APIs define how iOS apps can make their user interface available to an external assistive app or service. Accessibility in iOS
  4. 4. • How it Works – VoiceOver interacts with objects in your app to allow people with disabilities to drive the user interface in an alternative manner. For example, a VoiceOver user relies solely on an alternative set of gestures for control, and on speech synthesis or braille for feedback. – VoiceOver intercepts all the gestures on the screen - Settings => General =>Accessibility=>VoiceOver=>On - One Click or Touch => Focus - Double-Click => Activates - Three Fingers => Replaces one finger swipe - One Finger Swipe => Replaces Tab Key - Triple Click Home => Quick way to turn on/off VoiceOver Accessibility in iOS
  5. 5. Accessibility • Accessibility API introduced in iOS 3.0 • An accessibility interface – Allows another process to • Access individual items in the UI • Query for status and description • Perform actions and events • The remote process is an Assistive Technology (i.e. VoiceOver)
  6. 6. Accessibility Attributes Common Accessibility Attributes
  7. 7. Accessibility Traits • Accessibility Traits – Tell an assistive application how an accessibility element behaves or should be treated. • UIAccessibilityTraits – A mask that contains the OR combination of the accessibility traits that best characterize an accessibility element.
  8. 8. Other Accessibility Attributes
  9. 9. Adding Accessibility with Interface Builder • Changing Simple Accessibility values – accessibilityLabel – isAccessibilityElement – accessibilityHint – accessibilityTraits
  10. 10. Adding Accessibility in Code • If Accessibility values change
  11. 11. Accessibility Notifications • Notifications – Tell VoiceOver something has happened • 2 types of Accessibility Notifications – Those which your app can post. • You post accessibility notifications with UIAccessibilityPostNotification and observe with the default notification center. – And those which your app can observe. • The observable accessibility notifications are posted by UIKit when something in the app’s environment changes, such as when an accessibility setting is toggled, or when the layout of a screen changes.
  12. 12. Accessibility Notifications • Screen changes: when your UI changes dramatically. – Usually when a user moves into a different part of your app (navigates to a different screen). UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil); • Layout changes: if some part of your UI changes, but the user hasn’t necessarily jumped to an entirely different part of your app. – This notification tells VoiceOver to re-read the current state of all accessible items that are on-screen, and by doing this it figures out what has changed and informs the user of those changes. UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); • Dynamic changes: if a part of your user interface is dealing with some dynamically changing information (state changes, data changes, etc.). This notification tells VoiceOver to read it out to the user. • UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @”Loading complete.”);
  13. 13. VoiceOver-specific API • VoiceOver-specific API – Sometimes it is useful to determine whether or not VoiceOver is running, and to do different things depending on whether it is or not. – A program can, at any time, test to see whether VoiceOver is enabled or not.
  14. 14. VoiceOver-specific API • VoiceOver-specific API – Track where focus is
  15. 15. Accessibility Actions for Scrollable Elements • Scrollable Elements – Implement this method if a view in the view hierarchy supports a scroll by page action.
  16. 16. Accessibility Containers • Used for custom views with multiple containers • Returns Accessibility “sub-elements” – Ex. MonthView: UIView • Creating an Accessibility Sub-element (fake element) – Make a UIAccessibilityElement • Wraps all important data about an object and sends it over to VoiceOver
  17. 17. Accessibility Containers • Make the Contents of Custom Container Views Accessible – If your application displays a custom view that contains other elements with which users interact, you need to make the contained elements separately accessible. – Need to make sure that the container view itself is not accessible. The reason is that users interact with the contents of the container, not with the container itself. – Custom container view should implement the UIAccessibilityContainer protocol. • This protocol defines methods that make the contained elements available in an array. – The following container view creates the array of accessible elements only when methods of the UIAccessibilityContainer protocol are called. As a result, if iPhone accessibility is not currently active, the array is not created.
  18. 18. Accessibility Containers
  19. 19. Accessibility Containers
  20. 20. Best Practices for Accessibility • Use short concise labels – Good: “Add city” – Bad: “Add a city to the list of cities” • Don’t include the type information in the label – Good: “Remove City” – Bad: “Remove City button” • Use localized strings for labels and hints – Good: VoiceOver works in over 30 languages – Localize number and localize dates • Use NSNumberFormatter • With custom table view cells – Only need to add accessibilityLabel – If there are multiple strings, concatenate with commas
  21. 21. Summary • What is Accessibility? – What it means for an iOS developer – How do I make my apps accessible? • Common Accessibility Attributes & Traits • Adding Accessibility – Interface Builder – In Code • Accessibility Notifications • VoiceOver specific API • Scrollable Elements • Accessibility Containers • Best Practices for Accessibility
  22. 22. Resources – Accessibility Programming Guide for iOS http://developer.apple.com/library/ios/#documentation/UserExperience/ Conceptual/iPhoneAccessibility/Introduction/Introduction.html – UIAccessibility Protocol Reference http://developer.application.com for UIAccessibility – VoiceOver User Manual http://support.apple.com/manuals/iPhone/ – The Librarian: Accessibility on iOS: Make an App for Everyone http://yaccessibilityblog.com/wp/librarian-accessibility-ios.html – Mobile Accessiblity (posted on Oct 8, 2012 by Ted) http://www.last-child.com/mobile-accessibility