dismiss keyboard with a uiTextView

后端 未结 5 1529
醉话见心
醉话见心 2020-12-04 11:41

I am sure this is not that difficult, but I am having trouble finding info on how to dismiss a keyboard with the return/done key using a textview, not a textfield. here is w

5条回答
  •  萌比男神i
    2020-12-04 11:54

    to hide the keyboard touch on any part outside the textbox or textviews in swift 4 use this peace of code in the ViewController class:

    override func touchesBegan(_ touches: Set, with event: UIEvent?) {
        view.endEditing(true)
        super.touchesBegan(touches, with event: event)
    }
    

    Regards

提交回复
热议问题