UIAccessibilityReadingContent Protocol Reference

Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 5.0 and later.
Declared in
UIAccessibility.h

Overview

The UIAccessibilityReadingContent protocol can be implemented on an object that represents content that is intended to be read by users, such as a book or an article. To give VoiceOver users a superior, continuous reading experience, you can implement this protocol on such an element, characterize it with the UIAccessibilityTraitCausesPageTurn trait, and use the UIAccessibilityScrollDirectionNext and UIAccessibilityScrollDirectionPrevious constants to enable page turning.

Tasks

Accessing the Content on a Page

Instance Methods

accessibilityContentForLineNumber:

Returns the text associated with the specified line number. (required)

- (NSString *)accessibilityContentForLineNumber:(NSInteger)lineNumber
Parameters
lineNumber

A line number in the receiver’s content.

Return Value

A string containing the text that is associated with the specified line number, or nil if the line number is invalid. By default, this function returns nil.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIAccessibility.h

accessibilityFrameForLineNumber:

Returns the onscreen frame associated with the specified line number. (required)

- (CGRect)accessibilityFrameForLineNumber:(NSInteger)lineNumber
Parameters
lineNumber

The line number.

Return Value

The frame in the receiver that contains the specified line number, in screen coordinates. By default, this method returns CGRectZero.

Discussion

To determine the onscreen rectangle (or frame) of a line, you can use code such as the following:

CGRect lineBounds = // The bounds of the line in view space.
UIView *view = // The relevant view.
return UIAccessibilityConvertFrameToScreenCoordinates(lineBounds, view);
Availability
  • Available in iOS 5.0 and later.
Declared In
UIAccessibility.h

accessibilityLineNumberForPoint:

Returns the line number that contains the specified point. (required)

- (NSInteger)accessibilityLineNumberForPoint:(CGPoint)point
Parameters
point

A point within the bounds of the receiver’s view space, in screen coordinates. That is, a point for which [self pointInside:point withEvent:event] == YES.

Return Value

The line number that contains the specified point or NSNotFound if the point indicates an empty area within the receiver’s rectangle. By default, this method returns NSNotFound.

Discussion

This method is called only when point is within the bounds of the view or element.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIAccessibility.h

accessibilityPageContent

Returns the text displayed on the current page. (required)

- (NSString *)accessibilityPageContent
Return Value

A string that contains the text displayed on the current page.

Availability
  • Available in iOS 5.0 and later.
Declared In
UIAccessibility.h