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
First set delegate
with your UITextField
in self
class.
You can do with below 2 ways.
1. From storyboard
2. From Code ( You can write at viewDidLoad()
)
textField.delegate = self
Then declare protocol UITextFieldDelegate
in your class.
Now call delegate method.
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
self.view.endEditing(true)
return true
}