The corresponding code is as follows:
class GameViewController: UIViewController, UITextFieldDelegate {
...
override func touchesBegan(touches: Set,
withEvent event: UIEvent?) {
self.view.endEditing(true)
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
...
}
Additionally, if you have any buttons with IBActions attached to them you may need to have the line self.view.endEditing(true) in these also.
No comments:
Post a Comment