Created
January 9, 2013 21:20
-
-
Save marcuswestin/4497062 to your computer and use it in GitHub Desktop.
Remove the "next/prev/done" bar from UIWebView keyboards.
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)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