Created
October 15, 2020 01:33
-
-
Save andreconghau/45d93fef8d9c7a21f4593193ae9be27c to your computer and use it in GitHub Desktop.
can not called seletedAt after apply hideKeyboard when touch outside
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIViewController { | |
public func hideKeyboarOnTap() { | |
let tap = UITapGestureRecognizer(target: self, action: #selector(hideKeyboardAction)) | |
tap.cancelsTouchesInView = false | |
self.view.addGestureRecognizer(tap) | |
} | |
@objc private func hideKeyboardAction() { | |
self.view.endEditing(true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment