可能重复:
如何从虚拟键盘 IOS 中删除上一个下一个按钮
我在我的键盘中打开键盘,UIWebView
但根据默认结构,UIWebView
我在button
键盘顶部获取带有上一个、下一个和完成的栏。
它在我的应用程序中占用了很多空间,所以我想删除那个栏。
我怎样才能删除那个栏?
可能重复:
如何从虚拟键盘 IOS 中删除上一个下一个按钮
我在我的键盘中打开键盘,UIWebView
但根据默认结构,UIWebView
我在button
键盘顶部获取带有上一个、下一个和完成的栏。
它在我的应用程序中占用了很多空间,所以我想删除那个栏。
我怎样才能删除那个栏?
Register for notification on keyboard showing:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
Then:
- (void)removeBar
{
// Locate non-UIWindow.
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows])
{
if (![[testWindow class] isEqual:[UIWindow class]])
{
keyboardWindow = testWindow;
break;
}
}
// Locate UIWebFormView.
for (UIView *possibleFormView in [keyboardWindow subviews])
{
// iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView.
if ([[possibleFormView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound)
{
for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews])
{
if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound)
{
[subviewWhichIsPossibleFormView removeFromSuperview];
}
}
}
else if ([[possibleFormView description] rangeOfString:@"UIImageView"].location != NSNotFound)
{
[possibleFormView removeFromSuperview]; //remove shadow above bar. If it doesn't remove shadow then set possibleFormView's frame as CGRectZero
}
}
}