iOS Developer Library

Developer

UIKit Framework Reference UIAccessibilityReadingContent Protocol Reference

Options
Deployment Target:

On This Page
Language:

UIAccessibilityReadingContent

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.

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 5.0 and later.
  • Returns the line number that contains the specified point. (required)

    Declaration

    Swift

    func accessibilityLineNumberForPoint(_ point: CGPoint) -> Int

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func accessibilityContentForLineNumber(_ lineNumber: Int) -> String?

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func accessibilityFrameForLineNumber(_ lineNumber: Int) -> CGRect

    Objective-C

    - (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:

    Swift

    • let lineBounds: CGRect = // the bounds of the line in view space
    • let view: UIView = // the relevant view
    • return UIAccessibilityConvertFrameToScreenCoordinates(lineBounds, view)

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func accessibilityPageContent() -> String!

    Objective-C

    - (NSString *)accessibilityPageContent

    Return Value

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.