iOS keyboard style in webview?

后端 未结 2 1553
小鲜肉
小鲜肉 2021-01-16 23:23

I am pretty new to web development, my project is using Jquery-mobile, Phonegap and compass (scss).

By default, the keyboard showing up when an input field gets focu

2条回答
  •  没有蜡笔的小新
    2021-01-17 00:23

    I was working on iOS 7.0 and fixed it with the following code on 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];
                    }
                }
            }
        }
    }
    

    This works for me with the UIWebView keyboard issue on iOS 7.0

提交回复
热议问题