0
votes

Previously the UITextView I added with IB could have text selected without having the keyboard appear. However suddenly without changing anything this is not the case, how can I force this behaviour again?

(The text view needs to be editable but not when the user double taps to select text, only when the caret is inserted or the user just taps on the textview)

2

2 Answers

5
votes
    NSRange selection = [yourTextView.text rangeOfString:yourTextView.text]; 
    if( selection.location != NSNotFound ){ yourTextView.selectedRange = selection; }

This should do the trick for you.

1
votes

I think it is very simple. just make textview editable false before selecting the text so that testview never get responder. and then use the above code to get selected text