views:

501

answers:

1

Friends,

I've a problem in moving the cursor to first location. I've an application which keep adding the note. When user press "edit" button, i am launching another screen and want to move notes existing text at the bottom of TextView while cursor is on the first location. This behavior is similar to email reply screen. Here email body is attached with the reply screen while the cursor blinks start (0, 0) location of textView. Does anyone can help? how to do it?

+1  A: 

[textField becomeFirstResponder];

textField.selectedRange = NSMakeRange(0,0);

Does this work?

mjhoy
Nope, actually my textView area does not start at (0, 0). It is dynamic based on the contents on top cells. It looks likeFirst Row: textView (Subject of note, this is editable and expendable row)Second Row: textView (Note), I need to put the existing note and then set the cursor at start. I also need to add few lines blank and then show the existing note contents.
iamiPhone
I'm a little confused by your statement there. You want the edit cursor to start at the very beginning of the text in the text field, right? So, that's before the very first position in the text. textField.SelectedRange represents where the cursor is, so 0 is just before the first character, and the selection length is 0 so that you don't have any text selected.
Ed Marty
It's not text Field, it's text View.
iamiPhone