Frage

I want to place a focusmarker on the top row on a becomefirstresponder call. The textview contains a longer text and the focus is placed on the bottom on the textview's scrollview on a becomefirstresponder call.

I have been searching SO and the net, but i haven't found anything.

Any help would be appreciated!

War es hilfreich?

Lösung

To set focus at any place of active textView you need to do the following

NSRange zeroRange = NSMakeRange(offset,0);
textView.selectedRange = zeroRange;

Use this code after making textView first responder. Maybe you'll need to execute this with performSelector: afterDelay: after calling becomeFirstResponder.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top