webview中的iOS键盘风格?

我是Web开发的新手,我的项目是使用Jquery-mobile,Phonegap和指南针(scss)。

默认情况下,输入字段获得焦点时显示的键盘是一个键盘,其中包含一种带字段导航function的顶栏。 我想摆脱这个导航栏,并显示iOS中最简单的键盘。 我尝试将我的对象封装在一个表单中或没有表单标签,但没有成功。 我没有任何线索如何实现这一点,如果有可能,那就是:

感谢任何建议!

在此处输入图像描述

如果您遇到此问题 ,请务必访问https://bugreport.apple.com并复制rdar:// 9844216

要删除栏,您应该深入了解objective-c代码。

这是我使用的代码:(在包含UIWebview的控制器内添加以下代码)

首先添加一个观察者来接收键盘的通知:

-(void)viewWillAppear:(BOOL)animated{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; } - (void)keyboardWillShow:(NSNotification *)note { [self performSelector:@selector(removeBar) withObject:nil afterDelay:0]; } - (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 *formView in [keyboardWindow subviews]) { // iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView. if ([[formView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) { for (UIView *subView in [formView subviews]) { if ([[subView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) { // remove the input accessory view [subView removeFromSuperview]; } else if([[subView description] rangeOfString:@"UIImageView"].location != NSNotFound){ // remove the line above the input accessory view (changing the frame) [subView setFrame:CGRectZero]; } } } } } 

我正在使用iOS 7.0并在UIWebView上使用以下代码修复它

 -(void)removeExtraBar { UIWindow *keyboardWindow = nil; for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { if (![[testWindow class] isEqual:[UIWindow class]]) { keyboardWindow = testWindow; break; } } for (UIView *possibleFormView in [keyboardWindow subviews]) { if ([[possibleFormView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) { for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews]) { if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) { [subviewWhichIsPossibleFormView removeFromSuperview]; } else if([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIKBInputBackdropView"].location != NSNotFound) { [subviewWhichIsPossibleFormView removeFromSuperview]; } } } } } 

这适用于iOS 7.0上的UIWebView键盘问题