Prevent Keyboard from appearing when tapping on UITextField

前端 未结 6 786
孤城傲影
孤城傲影 2021-01-19 22:11

I\'m using a UITextField to show results of a calculation but I don\'t want the keyboard to appear when the user taps on the UIText

6条回答
  •  萌比男神i
    2021-01-19 22:37

    You can hide keyboard in UITextFieldDelegate method textFieldDidBeginEditing:(textField: UITextField) like below :

    func textFieldDidBeginEditing:(textField: UITextField) {
        self.view.endEditing(true)
    }
    

提交回复
热议问题