Remove the back cover, accessory keypad in iPhone 5 with iOS 8

I am working on an application in which I removed the back drop of the 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 works great on iPhone 5 with iOS8. But now I tested it on the iPhone 5 with iOS8, and it doesn’t work fine, the rear drop is removed, but it does not hide the accessory and the crash when touching the keyboard buttons. Please advice if anyone encounters this problem. I have searched many times, but I can’t find a solution. Thanks in advance.

+2
source share

Source: https://habr.com/ru/post/1545560/


All Articles