1

Hi I am trying to remove the UIWebFormAccesory that appears on top of the keyboard on iOS when entering text to a WKWebView text field. I have a slight hack below based on previous answers to this question, but they are all outdated and no longer work. I've added a picture below, with a red box around the bar I'm talking about:

enter image description here

The code below works if I run it 2x in a row, but then causes weird behavior on the keyboard, which eventually crashes the application.

for (UIWindow* wind in [[UIApplication sharedApplication] windows]) {
    for (UIView* currView in wind.subviews) {
        if ([[currView description] containsString:@"UIInputSetContainerView"]) {
            for (UIView* perView in currView.subviews) {
                for (UIView *subView in perView.subviews) {
                    if ([[subView description] containsString:@"UIWebFormAccessory"]) {
                        [subView setHidden:true];
                        [subView removeFromSuperview];
                        // CGRect f = perView.frame;
                        // CGRect n = CGRectMake(0, f.origin.y, f.size.width, f.size.height-44.0);
                        // [perView setFrame:n];
                    }
                }
            }
        }
    }
}

Was wondering if anyone has had any luck with this? I'm using Objective-C but a swift solution would be fine as well, thanks for the help!

Also here are the older threads that I have looked at, but haven't had any luck with:

How to find UIWebView toolbar (to replace them) on iOS 6?

Remove form assistant from keyboard in iPhone standalone web app

Asleepace
  • 3,466
  • 2
  • 23
  • 36

0 Answers0