1

I've been following the iOS7 Day-by-Day multi-page TextKit tutorial, and ran into an issue with accessibility. The code for the tutorial is here: iOS7 Day-by-Day

The problem is that each of the text views (one per column, two per "page") seems to contain the entire string, and with VoiceOver enabled, every time a column gets the focus, the text is read from the very beginning of the string to the very end, instead of reading the text that is actually visible in a column.

The textviews/columns are created using the new iOS7 method

UITextView *textView = [[UITextView alloc] initWithFrame:textViewFrame textContainer:textContainer];

How can I get VoiceOver to read only the visible text in each column?

user1459524
  • 3,613
  • 4
  • 19
  • 28

1 Answers1

0

Sounds like you simply need to determine what text is visible and then pass that to VoiceOver.

To do that, you can use the two possible methods found in this related question and with the range of the visible text, you can then create a substring via something like:

NSString *textToPassToVoiceOver = [[textView.text] rangeOfSubstring:visibleTextRange];

Makes sense?

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Kinda. Isn't it a little weird to have to calculate the visible range of text again after just doing the calculation of how to fit it into columns and text containers? Also, how do I pass the substring to VoiceOver? Does that mean that I have to set the accessibility.label for each textview manually? This all feels like a workaround. Why isn't the textviews text property simply set to the text container it represents? – user1459524 May 05 '14 at 12:19