开发者

move cursor up/down in UITextView

The only public API I found allowed me only to move the cursor right/left using selectedRa开发者_StackOverflow中文版nge property. Any workaround to perform that task up/down?

Thanks


If you haven't found an answer, you may just have to develop your own custom component using Core Text.


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

You can count the number of \n characters up to the current range.location and set the new range.location to a \n before to the cursor up a row or to a \n after the cursor to move it down.

If you want to move it up or down and keep it in line with the characters on the row you will need to count the number of characters on each row and move it to the right location

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜