删除ios7上的键盘表单工具栏留下一个模糊 [英] Remove Keyboard Form toolbar on ios7 leaves a blur behind

查看:220
本文介绍了删除ios7上的键盘表单工具栏留下一个模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以删除工具栏,但我的左边的宽度模糊的工具栏的高度。

I can remove the toolbar but I am left width a blur of the height the toolbar was.

有关如何删除此任何想法?

Any idea on how to remove this?

下面的代码是函数。这是很直接。
我在webview中使用phonegap。

The code below is the function. It's pretty straight forward. I use this in a webview using phonegap.

-(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) {

            // remove the border above the toolbar in iOS 6
            [
                [possibleFormView layer] setMasksToBounds: YES];

            for (UIView * subviewWhichIsPossibleFormView in [possibleFormView subviews]) {
                if ([
                    [subviewWhichIsPossibleFormView description] rangeOfString: @"UIWebFormAccessory"].location != NSNotFound) {
                    [subviewWhichIsPossibleFormView removeFromSuperview];

                    // http://stackoverflow.com/questions/10746998/phonegap-completely-removing-the-black-bar-from-the-iphone-keyboard/10796550#10796550
                    UIScrollView * webScroll;
                    if ([
                        [
                            [UIDevice currentDevice] systemVersion] floatValue] >= 5.0) {
                        webScroll = [
                            [self webView] scrollView];
                    } else {
                        webScroll = [
                            [
                                [self webView] subviews] lastObject];
                    }

                    CGRect newFrame = [webScroll frame];

                    float accessoryHeight = [subviewWhichIsPossibleFormView frame].size.height;
                    newFrame.size.height += accessoryHeight;

                    [subviewWhichIsPossibleFormView removeFromSuperview];
                    [webScroll setFrame: newFrame];
                }
            }
        }
    }
}


$ b b


如果您遇到此问题转到 https://bugreport.apple.com 并复制rdar:// 9844216

If you hit this problem, make sure to head over to https://bugreport.apple.com and duplicate rdar://9844216

推荐答案

- (void)removeKeyboardTopBar {
// 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]) {
    if ([[possibleFormView description] hasPrefix:@"<UIPeripheralHostView"]) {
        for (UIView* peripheralView in possibleFormView.subviews) {

            // HERE!! hides the backdrop (iOS 7)
            if ([[peripheralView description] hasPrefix:@"<UIKBInputBackdropView"]) {
                [[peripheralView layer] setOpacity:0.0];
            }
            // hides the accessory bar
            if ([[peripheralView description] hasPrefix:@"<UIWebFormAccessory"]) {
                // remove the extra scroll space for the form accessory bar
                CGRect newFrame = diaryEditorView.scrollView.frame;
                newFrame.size.height += peripheralView.frame.size.height;
                diaryEditorView.scrollView.frame = newFrame;

                // remove the form accessory bar
                [peripheralView removeFromSuperview];
            }
            // hides the thin grey line used to adorn the bar (iOS 6)
            if ([[peripheralView description] hasPrefix:@"<UIImageView"]) {
                [[peripheralView layer] setOpacity:0.0];
            }
        }
    }
}

}

这篇关于删除ios7上的键盘表单工具栏留下一个模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆