Remove back drop,accessory bar of keyboard in iPhone 5s with iOS 8

拥有回忆 提交于 2020-01-24 15:02:11

问题


I am working on a app in which I have removed the back drop of keyboard using this code in iOS8 with iPhone 5:

- (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:@"<UIInputSetContainerView"])
            {
                for(int i = 0 ; i < [possibleFormView.subviews count] ; i++)
                {
                    UIView* hostkeyboard = [possibleFormView.subviews objectAtIndex:i];
                 if([[hostkeyboard description] hasPrefix:@"<UIInputSetHostView"])
                    {
                        for (id temp in hostkeyboard.subviews)
                        {
                            if ([[temp description] hasPrefix:@"<UIKBInputBackdropView"])
                            {
                                [[temp layer] setOpacity:0.0];
                            }
                            if ([[temp description] hasPrefix:@"<UIWebFormAccessory"])
                            {
                               [temp removeFromSuperview];
                            }
                            if ([[temp description] hasPrefix:@"<UIImageView"])
                            {
                                [[temp layer] setOpacity:0.0];
                            }
            }
        }
}
}
    }

It is working fine in iPhone 5 with iOS8.But now I have tested it on iPhone 5s with iOS8 and it is not working fine the back drop is removed but it has not hides the accessory bar and crash when we touch the keyboard buttons. Please advice if anybody has face this issue. I have already searched a lot but can't find a solution. Thanks in advance.

来源:https://stackoverflow.com/questions/26213708/remove-back-drop-accessory-bar-of-keyboard-in-iphone-5s-with-ios-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!