Skip to content

Instantly share code, notes, and snippets.

@marcuswestin
Created January 10, 2013 20:44
Show Gist options
  • Save marcuswestin/4505623 to your computer and use it in GitHub Desktop.
Save marcuswestin/4505623 to your computer and use it in GitHub Desktop.
Programmatically blur the currently focused input field inside of a UIWebVIew
- (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