Created
August 30, 2014 07:50
-
-
Save jkyin/6e7042b28832ff4a752f to your computer and use it in GitHub Desktop.
UIWebView dismiss keyboard
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
// implement <UIGestureRecognizerDelegate> | |
{ | |
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; | |
tapRecognizer.numberOfTapsRequired = 1; | |
tapRecognizer.numberOfTouchesRequired = 1; | |
tapRecognizer.delegate = self; | |
[self.webView addGestureRecognizer:tapRecognizer]; | |
} | |
- (void)tap:(UITapGestureRecognizer *)gr | |
{ | |
NSLog(@"Tap!"); | |
[self.webView endEditing:YES]; | |
} | |
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment