I have a UITextView which allows some RichTextEditing. I want that whenever user taps on certain location of text, the cursor should move there and editing should be started from that location.
Issue: What happens is, when I drag the cursor to any location of my choice and write something cursor immediately moves to the end of text of UITextView and starts writing. I want edit to start from user tapped location or cursor location.
Following are the functions I am using.
-(void) textViewDidBeginEditing{
//Can set the cursor or selected Range of textView here or tap gesture recognizer required?
return true;
}
-(void) textViewDidEndEditing{
return true;
}
-(void) textViewDidChangeTextInRange:(UITextView *) textView range:(NSMakeRange) range replacementText: (NSString *) text{
//Sets attributed text of my TextView based on my input AccessoryView
if(textView.text.lenght > range.location){
//This is my point of concern where I want to start the editing
}
return false;
}
Excuse me for my code mistakes. I don't have access to my objectiveC code now. It was written to give you an idea what I am doing. I found this but could not get it to work. I am using UITextView it is using field. how to move cursor in UITextField after setting its value
Kindly guide me.