0

I am displaying a text document using many UITextViews, one for each paragraph*. When the user drags the caret around it obviously stops when he reaches the beginning or end of a paragraph. Is there any way of letting the user drag the caret between text views as if all the text was in one text view? In a way that is allowed in the App Store?


* There is a good reason for this, at least if my proof-of-concept actually succeeds in proving the concept.

kareman
  • 711
  • 1
  • 6
  • 16

1 Answers1

0

This would be a pain in the ass to implement, but going off this answer as an indicator of cursor-on-text:

how to get selected text from uitextfield in iphone?

Check the position of the cursor, and if it matches the length of text in a textfield, start a gesture listener, and if it moves down and right, change the focus to the next textview. Keep your textviews in an array for easy accessing.

Community
  • 1
  • 1
Michael Voznesensky
  • 1,612
  • 12
  • 15
  • I can change which view has the focus and the location of the caret programmatically, the problem is letting the user do that without having to lift her finger and put it down again in the next paragraph. – kareman Feb 27 '15 at 23:34
  • Yes, my answer would help you with that. – Michael Voznesensky Feb 27 '15 at 23:55
  • Ah sorry, didn't understand what you meant at first. – kareman Mar 04 '15 at 23:20
  • [This test](https://github.com/kareman/Drag-caret-between-text-views/tree/7d2fcac23c73e7ffc0e89bf685b423b966533e12) moves the focus to the next text view when the caret reaches the end of the text, which it will when the user drags the caret below the last line or presses the down key on a keyboard when on the last line. But the original gesture still continues even though the view lost the focus, so the loupe/magnifying glass still follows the finger around but doesn't move the caret. And yes this is going to be a pain to implement. – kareman Mar 04 '15 at 23:39
  • Also tried [moving the gesture recognizer](https://github.com/kareman/Drag-caret-between-text-views) in progress to the bottom view, but no luck. – kareman Mar 05 '15 at 22:34