accessibility on ios - stanford university · about me •b.s. duke ’02 •peace corps (tonga)...

47
Make an app for everyone Chris Fleizach iOS Accessibility Accessibility on iOS Wednesday, December 1, 2010

Upload: others

Post on 24-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Make an app for everyone

Chris FleizachiOS Accessibility

Accessibility on iOS

Wednesday, December 1, 2010

Page 2: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

About me

• B.S. Duke ’02

• Peace Corps (Tonga)

•M.S. UCSD ’06

• Four years at Apple (including internship)

■ VoiceOver (Mac OS X)■ iOS Accessibility

Wednesday, December 1, 2010

Page 3: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

• Closed Captioning• Zoom• Screen readers•Many others…

Accessibility

Wednesday, December 1, 2010

Page 4: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Settings › General › Accessibility

Wednesday, December 1, 2010

Page 5: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

“I predict that the visually impaired community will agree that the iPhone was the single biggest game changing piece of technology for the assistive tech industry in modern times.”Josh de Lioncourt, maccessibility.net

Wednesday, December 1, 2010

Page 6: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

VoiceOver and Accessibilityand Video

Demo

Wednesday, December 1, 2010

Page 7: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

• iOS Accessibility Overview•UIAccessibility Protocol

■ Accessibility Attributes■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 8: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility API

•An accessibility interface allows another process to■ Access individual items in the user interface■ Query for status, state and description■ Perform actions and events

• The remote process is an Assistive Technology (i.e. VoiceOver)

Wednesday, December 1, 2010

Page 9: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Architecture

“Cupertino, 10:57AM”

UI Accessibility ProtocolVoiceOver UI Accessibility

Protocol

Wednesday, December 1, 2010

Page 10: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Making Accessible Apps

•Accessibility API introduced in iOS 3.0■ Lives in UIKit in UIAccessibility.h

•Allows an app to provide UI information to VoiceOver• Standard controls in UIKit already accessible

Wednesday, December 1, 2010

Page 11: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility attributes return information about the elementUIAccessibility API: Attributes

- (BOOL)isAccessibilityElement

- (NSString *)accessibilityLabel

- (UIAccessibilityTraits)accessibilityTraits

- (CGRect)accessibilityFrame

- (NSString *)accessibilityHint

- (NSString *)accessibilityValue

Wednesday, December 1, 2010

Page 12: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Common Accessibility Attributes

■ Return YES to make VoiceOver see this element

■ A textual representation of the element

- (BOOL)isAccessibilityElement

- (NSString *)accessibilityLabel

Wednesday, December 1, 2010

Page 13: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Traits

■ Defines behavior■ Bitmask of integers

- (UIAccessibilityTraits)accessibilityTraits

Wednesday, December 1, 2010

Page 14: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Traits

Image

ButtonAdjustable

Static Text

| Starts Media Session

| Summary Element

Wednesday, December 1, 2010

Page 15: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Other Accessibility Attributes

■ The onscreen rectangle for the UI element

■ A dynamically changing value that describes the UI element

■ A string that provides additional help

- (CGRect)accessibilityFrame

- (NSString *)accessibilityValue

- (NSString *)accessibilityHint

Wednesday, December 1, 2010

Page 16: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Adding Accessibility with IBChange simple accessibility values

isAccessibilityElement accessibilityLabel

accessibilityHint accessibilityTraits

Wednesday, December 1, 2010

Page 17: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Introduction to iPhone AccessibilityDemo

Wednesday, December 1, 2010

Page 18: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

•UIAccessibility Protocol■ Accessibility Attributes

■ Adding Accessibility in Code■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 19: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Adding Accessibility in CodeIf accessibility values don’t change

- (void)awakeFromNib { ...

UIControl *control = [[UIControl alloc] initWithFrame:frame]; control.isAccessibilityElement = YES; control.accessibilityLabel = @"Play"; [window addSubview:control];

...}

Wednesday, December 1, 2010

Page 20: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

If accessibility values changeAdding Accessibility in Code

@implementation MyTemperatureView

- (NSString *)accessibilityLabel { return @"Current Temperature";}

- (NSString *)accessibilityValue { return [cityWeather currentTemperatureAsString];}

@end

- (BOOL)isAccessibilityElement { return YES;}

Wednesday, December 1, 2010

Page 21: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

NotificationsTell VoiceOver something happened

UIAccessibilityPostNotification( UIAccessibilityScreenChangedNotification, nil);

UIAccessibilityPostNotification( UIAccessibilityLayoutChangedNotification, nil);

Wednesday, December 1, 2010

Page 22: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

NotificationsTell VoiceOver something happened

UIAccessibilityPostNotification( UIAccessibilityAnnouncementNotification, @"89 degrees east");

Wednesday, December 1, 2010

Page 23: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Setting Accessibility Attributes Demo

Wednesday, December 1, 2010

Page 24: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

•UIAccessibility Protocol■ Accessibility Attributes■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 25: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Containers

• For custom views with multiple parts• Returns accessibility “sub-elements”

MonthView : UIView

Wednesday, December 1, 2010

Page 26: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Containers

• For custom views with multiple parts• Returns accessibility “sub-elements”

“October 14th”

Wednesday, December 1, 2010

Page 27: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Containers

• For custom views with multiple parts• Returns accessibility “sub-elements”

“October 11th”

Wednesday, December 1, 2010

Page 28: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Creating a Sub ElementMake a UIAccessibilityElement

UIAccessibilityElement *dayPart = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:monthView];

dayPart.accessibilityLabel = @"October 14th";

dayPart.accessibilityFrame = CGRectMake(200, 200, 50, 50);

[accessibilityElements addObject:dayPart];

Text

UIAccessibilityElement

“October 14th”

{ 200, 200, 50, 50 }

dayPart.accessibilityTraits = UIAccessibilityTraitSelected;

Selected

Wednesday, December 1, 2010

Page 29: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility ContainerMirrors NSArray

@implementation MonthView

- (NSInteger)accessibilityElementCount { return [accessibilityElements count];}- (id)accessibilityElementAtIndex:(NSInteger)index { return [accessibilityElements objectAtIndex:index]}- (NSInteger)indexOfAccessibilityElement:(id)element { return [accessibilityElements indexOfObject:element]}@end

Wednesday, December 1, 2010

Page 30: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility Container ProtocolDemo

Wednesday, December 1, 2010

Page 31: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

•UIAccessibility Protocol■ Accessibility Attributes■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 32: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

@implementation PageControl

Accessibility ActionsAdjustable elements

- (UIAccessibilityTraits)accessibilityTraits { return [super accessibilityTraits] | UIAccessibilityTraitAdjustable;}- (void)accessibilityIncrement { [self moveToNextPage];}

@end

- (void)accessibilityDecrement { [self moveToPreviousPage];}

Wednesday, December 1, 2010

Page 33: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

@implementation CityView

Accessibility ActionsScrollable elements

-(BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {

return NO;

}

if (direction == UIAccessibilityScrollDirectionLeft) { [self scrollLeft]; UIAccessibilityPostNotification (UIAccessibilityPageScrolled, @"Showing Cupertino"); return YES; } else if (direction == UIAccessibilityScrollDirectionRight) { [self scrollRight]; UIAccessibilityPostNotification (UIAccessibilityPageScrolled, @"Showing San Diego"); return YES; }

Wednesday, December 1, 2010

Page 34: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessibility ActionsDemo

Wednesday, December 1, 2010

Page 35: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

•UIAccessibility Protocol■ Accessibility Attributes■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 36: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

■ Is VoiceOver on?BOOL UIAccessibilityIsVoiceOverRunning()

VoiceOver-specific API

UIAccessibilityVoiceOverStatusChanged■ A notification to determine when VoiceOver is enabled.

Wednesday, December 1, 2010

Page 37: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

VoiceOver-specific API

- (void)accessibilityElementDidBecomeFocused■ Did VoiceOver focus on this element?

- (void)accessibilityElementDidLoseFocus■ Did VoiceOver focus leave this element?

- (BOOL)accessibilityElementIsFocused■ Is VoiceOver focused on this element?

Wednesday, December 1, 2010

Page 38: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Best Practices

•Use short, concise labels■ Good: “Add city” ■ Bad: “Adds a city to the list of cities”

Wednesday, December 1, 2010

Page 39: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Best Practices

•Don’t include the type information in the label■ Good: “Remove city”■ Bad: “Remove city button”

Wednesday, December 1, 2010

Page 40: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Best Practices

•Use localized strings for labels and hints■ VoiceOver works in over 30 languages

Wednesday, December 1, 2010

Page 41: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Best Practices

•With custom table view cells■ Only need to add accessibilityLabel■ If there are multiple strings, concatenate with commas

- (NSString *)accessibilityLabel { return [NSString stringWithFormat:@"%@, %@", [self header], [self summary]];}

@implementation NewsTableViewCell

@end

Wednesday, December 1, 2010

Page 42: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Accessible BowlingDemo

Wednesday, December 1, 2010

Page 43: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

What You’ll Learn

•UIAccessibility Protocol■ Accessibility Attributes■ Accessibility Containers■ Accessibility Actions■ VoiceOver-specific API

• Best Practices•Apps for users with disabilities

Wednesday, December 1, 2010

Page 44: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Apps for users with disabilities

•Accessibility features on iOS has created a large user base•Opportunity to develop apps addressing specific needs

Digit-Eyes oMobySayText

iCanSee Proloquo2GoiPrompts

Wednesday, December 1, 2010

Page 45: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Summary

•Add accessibility■ Increases user base■ Heaps of praise■ Karmic improvement

•Apps for users with disabilities■ Incredible innovation awaits

Wednesday, December 1, 2010

Page 46: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

More Information

DocumentationAccessibility Programming Guideline for iOSSearch on http://developer.apple.com/ for Accessibility

UIAccessibility Protocol ReferenceSearch on http://developer.apple.com/ for UIAccessibility

VoiceOver User Manualhttp://support.apple.com/manuals/iphone

Wednesday, December 1, 2010

Page 47: Accessibility on iOS - Stanford University · About me •B.S. Duke ’02 •Peace Corps (Tonga) •M.S. UCSD ’06 •Four years at Apple (including internship) VoiceOver (Mac OS

Wednesday, December 1, 2010