当您在当前未编辑的UITextView上调用selectedRange时,您检查的NSRange返回值是什么?

时间:2011-03-12 22:52:47

标签: ios uitextview

当您在当前未编辑的UITextView上调用selectedRange时,您检查的NSRange返回值是什么?

1 个答案:

答案 0 :(得分:22)

找到答案:

NSRange range = textView.selectedRange;

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

} else {
  //There is a valid range.

}