After some moment I need deselect text in UITextView. How do I deselect text in UITextView?
EDIT: I need to do programmatically.
UITextView
adopts the UITextInput
protocol, which has a selectedTextRange
property. Set the property to nil:
self.textView.selectedTextRange = nil;
This is the way it works and you can touch wherever you want in the view in order to deselect the previously selected text:
On your UIViewController write this function:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
self.view.endEditing(true)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With