ios - Start Editing UITextView on User Tapped Location -


After

I have a UITextView which allows some RichTextEditing. I want that whenever the user gets to some place in the text, the cursor should move there and start editing from that place.

issue: When I drag the cursor to any place of my choice and write some cursor immediately takes to the end of the text of the UITextView and starts writing, So what happens is that. I want to make edits to start with user location or cursor location.

I am using the following functions:

  - (zero) textViewDidBeginEditing {// cursor or TextView can set the selected range here or tap the necessary gesture identifier? Back true; } - (zero) textViewDidEnditing {return true; } - (zero) textViewDidChangeTextInRange: (UITextView *) TextView Range: (NSMakeRange) ranging replacementText: (NSString *) text {// My textView attributed the set text is my input AccessoryView if based on (textView.text.lenght & gt; ; Range. Location) {// This is my concern, where I want to start editing} Return false; }  

Sorry for my code mistakes. I no longer have access to the C code. It was written to give you an idea of ​​what I am doing. I found it but could not get it to work. I'm using it UITextView is using this field.

Please guide me.

"itemprop =" text ">

There is some kind of problem related to Apple Work. I added code reference here in my function

  - (bool) TextView: (UITextView *) TextView shouldChangeTextInRange: replacementText: (NSString *) text {// code from stackoverflow question}  

But that does not work. I then added the same code to another function and shouldChangeTextInRange and it worked !!!

This is called as the selector of the work code:

  - (zero) setCursorToCorrectPosition {// code from stackoverflow question} - (Bool) TextView: (UITextView *) TextView shouldChangeTextInRange: replacementText: (NSString *) text {{self-PerformSelector: @selector (SetCursorToCorrectPosition) withObject: after zero: 0.01]; }  

Comments