Skip to content

Instantly share code, notes, and snippets.

@meyusufdemirci
Last active March 31, 2018 15:50
Show Gist options
  • Select an option

  • Save meyusufdemirci/41f23a022c6c72b0616e7852a198622c to your computer and use it in GitHub Desktop.

Select an option

Save meyusufdemirci/41f23a022c6c72b0616e7852a198622c to your computer and use it in GitHub Desktop.
override func viewDidLoad() {
super.viewDidLoad()
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment