Skip to content

Instantly share code, notes, and snippets.

@azakordonets
Created May 28, 2015 13:44
Show Gist options
  • Select an option

  • Save azakordonets/2f1c43b02d4e2af80114 to your computer and use it in GitHub Desktop.

Select an option

Save azakordonets/2f1c43b02d4e2af80114 to your computer and use it in GitHub Desktop.
This two methods should be included into the file, so it would make keyboard disappear on Enter button push, or tap outside the keyboard
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
self.view.endEditing(true)
}
func textFieldShouldReturn(input: UITextField) -> Bool {
input.resignFirstResponder()
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment