Skip to content

Instantly share code, notes, and snippets.

@marcuswestin
Created January 9, 2013 21:20
Show Gist options
  • Save marcuswestin/4497062 to your computer and use it in GitHub Desktop.
Save marcuswestin/4497062 to your computer and use it in GitHub Desktop.
Remove the "next/prev/done" bar from UIWebView keyboards.
- (void)keyboardWillShow:(NSNotification *)notification {
[self performSelector:@selector(removeWebViewKeyboardBar) withObject:nil afterDelay:0];
}
- (void)removeWebViewKeyboardBar {
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
if (![[testWindow class] isEqual:[UIWindow class]]) {
keyboardWindow = testWindow;
break;
}
}
if (!keyboardWindow) { return; }
for (UIView *possibleFormView in [keyboardWindow subviews]) {
if ([[possibleFormView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) {
for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews]) {
if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIImageView"].location != NSNotFound) {
// ios6 on retina phone adds a drop shadow to the UIWebFormAccessory. Hide it.
subviewWhichIsPossibleFormView.frame = CGRectMake(0,0,0,0);
} else if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) {
// This is the "prev/next/done" bar
[subviewWhichIsPossibleFormView removeFromSuperview];
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment