Move cursor up / down in a UITextView

The only public API I found allowed me to only move the cursor left / right using the selectedRange property. Any workaround for doing this up / down task?

thanks

+4
source share
2 answers

If you can’t find the answer, you just need to develop your own component using Core Text.

+1
source

This is a pretty old question ... but for those still trying to find a way to do this:

You can count the number of characters \ n to the current range .location and set the new range.location to \ n before the cursor moves up the line or \ n after the cursor moves down.

If you want to move it up or down and save it according to the characters in the line, you will need to count the number of characters in each line and move them to the right place.

0
source

All Articles