问题
I have a text based app where I want my users to make use of the 'Lines' rotor option when VoiceOver is enabled. However the option doesn't appear. The text in my app is laid out using cells in a tableview (the cells contain UILabels and other views).
I'm afraid my implementation affects how the rotor is "seeing" my app, but I think it's unfortunate if it limits me from supporting the rotor fully.
Is there any way I can make use of the 'Lines' option in the rotor?
回答1:
I think you are looking for the UIAccessibilityReadingContent
protocol.
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.
There are four methods to implement:
accessibilityLineNumberForPoint:
accessibilityContentForLineNumber:
accessibilityFrameForLineNumber:
accessibilityPageContent
You are going to have to figure out how to cut the text into lines, the frame of each line and what line a certain point belongs to (hit testing) but since you are using table views you should be able to hook into the frames of the cells to figure out those things.
来源:https://stackoverflow.com/questions/22793032/can-i-influence-what-appears-in-the-voiceover-rotor