I have a custom textfield. It opens a pop-up using UITableViewController
, when user taps on it.
I wanted to prevent keyboard to pop-up for my text field, looks like it is not possible.
So I tried the following code which works in simulator, but it does not work for an actual iPhone!!!
@IBAction func provincePressed(_ sender: Any) {
(sender as AnyObject).resignFirstResponder()
self.view.endEditing(true)
What is wrong? and how can I make it work for an actual iPhone? or possibly prevent keyboard to show up at all!
Try to return false in the textFieldShouldBeginEditing method
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
return false
}