How would you dismiss the keyboard from the UITextField when tapping outside of the keyboard? I have tried resignFirstResponder()
and it only exits after typing one number. I have also tried textField.inputView = UIView.frame(frame: CGRectZero)
. I have seen many Objective-C verisons of what I'm asking but I need the Swift equivalent because I have no programming experience in Objective-C.
You could also use this method to dismiss the keyboard when pressing 'Return'
func textFieldShouldReturn(textField: UITextField!) -> Bool {
self.view.endEditing(true);
return false;
}
Make sure to set your delegate