I want to change the selected part of the text in textview or highlighted the selected text in textView.is it possible through any delegate methods of textView.
Thanks in advance
I want to change the selected part of the text in textview or highlighted the selected text in textView.is it possible through any delegate methods of textView.
Thanks in advance
Implement the textViewDidChangeSelection:
delegate method to be notified when the selection changes. Then use the UITextView selectedRange
property to get the selected range.
Use the UITextView attributedText
property to get the text view's attributed text. Create NSMutableAttributedText
from that. And then apply the desired color attribute to the proper range. Finally, apply the updated attributed text to the text view.
All of this requires iOS 6.0 or later.