0

Possible Duplicate:
how to remove prev next button from virtual keyboard IOS

I am opening keyboard in my UIWebView but as per the default structure of UIWebView I am getting Bar with Previous, Next and Done button on the top of keyboard.

It consumes much space in my app so, I want to remove that bar.

How can I remove that bar?

Community
  • 1
  • 1
iPhone
  • 4,092
  • 3
  • 34
  • 58

1 Answers1

0
Register for notification on keyboard showing:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
Then:

- (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)
        {
            for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews])
            {
                if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound)
                {
                    [subviewWhichIsPossibleFormView removeFromSuperview];
                }
            }
        }
        else if ([[possibleFormView description] rangeOfString:@"UIImageView"].location != NSNotFound)
        {
            [possibleFormView removeFromSuperview]; //remove shadow above bar. If it doesn't remove shadow then set possibleFormView's frame as CGRectZero
        }
    }
}
Rahul Wakade
  • 4,765
  • 2
  • 23
  • 25