Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What NSRange return value do you check for when you call selectedRange on a UITextView that is not currently being edited?

Tags:

ios

uitextview

What NSRange return value do you check for when you call selectedRange on a UITextView that is not currently being edited?

like image 418
MikeN Avatar asked Mar 12 '11 22:03

MikeN


1 Answers

Found the answer:

NSRange range = textView.selectedRange;

if (range.location == NSNotFound) {
  //The textfield was not selected.

} else {
  //There is a valid range.

}
like image 124
MikeN Avatar answered Oct 13 '22 22:10

MikeN