views:

104

answers:

1

Hello Everyone,

How do I grab SELECTED/HIGHLIGHTED text on a UITextView. I already know how to do this on UIWebView using javascript. Now I am trying to figure it out for the UITextView.

Thanks for your help.

+1  A: 

you can do it by

NSRange range = [txtView selectedRange];
NSString *str = [txtView.text substringWithRange:range];
mihirpmehta
you have a little typo at the end of your last line there.
willc2
yes thanks... :)
mihirpmehta