sol*_*hoe 0 keyboard webview ios jquery-mobile cordova
我是Web开发的新手,我的项目是使用Jquery-mobile,Phonegap和指南针(scss).
默认情况下,输入字段获得焦点时显示的键盘是一个键盘,其中包含一种带字段导航功能的顶栏.我想摆脱这个导航栏,并显示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];
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3258 次 |
| 最近记录: |