I have a TextView and I need to insert a word in a string from the location. Use this method to derive the location
NSInteger location = textView.selectedRange.location;
But I do not know how to put this into a string.
Thanks a lot
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to replace the selection with a word, the simplest would be something like this:
For an empty selection, this would insert the text at the caret position, if text is selected, it would be replaced. On iOS 5, using the methods in the
UITextInputprotocol would probably be more efficient, but also more cumbersome to use.