How do I deselect text in UITextView?

前端 未结 3 718
予麋鹿
予麋鹿 2021-01-04 05:47

After some moment I need deselect text in UITextView. How do I deselect text in UITextView?

\"enter

3条回答
  •  春和景丽
    2021-01-04 06:23

    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, withEvent event: UIEvent?) {
    
        self.view.endEditing(true)
    }
    

提交回复
热议问题