0
可能重複:
how to remove prev next button from virtual keyboard IOS如何使用上一個和下一個按鈕並在UIWebView上完成鍵盤欄的移除?
我打開鍵盤在我UIWebView
但每UIWebView
默認結構我正在酒吧與上一頁,下一頁和頂部完成button
鍵盤。
它在我的應用程序中消耗很多空間,所以我想刪除該欄。
如何刪除該欄?
可能重複:
how to remove prev next button from virtual keyboard IOS如何使用上一個和下一個按鈕並在UIWebView上完成鍵盤欄的移除?
我打開鍵盤在我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
}
}
}