TompaLompa
TompaLompa

Reputation: 949

IOS UITextview: Place focus on becomefirstresponder

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!

Upvotes: 0

Views: 253

Answers (1)

malex
malex

Reputation: 10096

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.

Upvotes: 1

Related Questions