Created
January 10, 2013 20:44
-
-
Save marcuswestin/4505623 to your computer and use it in GitHub Desktop.
Programmatically blur the currently focused input field inside of a UIWebVIew
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
- (void) blur:(UIWebView*)webView { | |
[self findAndResignFirstResponder:webView]; | |
} | |
- (bool) findAndResignFirstResponder:(UIView*)view { | |
if ([view isFirstResponder]) { | |
[view resignFirstResponder]; | |
return YES; | |
} | |
for (UIView* subview in [view subviews]) { | |
if ([self findAndResignFirstResponder:subview]) { return YES; } | |
} | |
return NO; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment