Created
October 21, 2016 17:20
-
-
Save dsappet/720575ede2b768bf4df38e79b39c3755 to your computer and use it in GitHub Desktop.
Some simple useful stuff for xamarin ios
This file contains hidden or 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
| /// <summary> | |
| /// Call it to force dismiss keyboard when background is tapped | |
| /// Just call this in the viewdidload() of a controller and any keyboard will dismiss on tapping outside the keyboard | |
| /// </summary> | |
| protected void DismissKeyboardOnBackgroundTap() | |
| { | |
| // Add gesture recognizer to hide keyboard | |
| var tap = new UITapGestureRecognizer { CancelsTouchesInView = false }; | |
| tap.AddTarget(() => View.EndEditing(true)); | |
| View.AddGestureRecognizer(tap); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment