Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, listen keyboard events:</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; </code></pre> <p>when keyboard will show,remove the toolbar:</p> <pre><code>- (void)keyboardWillShow:(NSNotification *)note { [self performSelector:@selector(removeBar) withObject:nil afterDelay:0]; } </code></pre> <p>the removeBar is as follows:</p> <pre><code>- (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]) { if ([[possibleFormView description] hasPrefix:@"&lt;UIPeripheralHostView"]) { for (UIView* peripheralView in [possibleFormView subviews]) { // hides the backdrop (iOS 7) if ([[peripheralView description] hasPrefix:@"&lt;UIKBInputBackdropView"]) { //skip the keyboard background....hide only the toolbar background if ([peripheralView frame].origin.y == 0){ [[peripheralView layer] setOpacity:0.0]; } } // hides the accessory bar if ([[peripheralView description] hasPrefix:@"&lt;UIWebFormAccessory"]) { // remove the extra scroll space for the form accessory bar UIScrollView *webScroll; if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 5.0) { webScroll = [[self webView] scrollView]; } else { webScroll = [[[self webView] subviews] lastObject]; } CGRect newFrame = webScroll.frame; newFrame.size.height += peripheralView.frame.size.height; webScroll.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:@"&lt;UIImageView"]) { [[peripheralView layer] setOpacity:0.0]; } } } } } </code></pre> <p>Reference: <a href="https://github.com/don/KeyboardToolbarRemover/blob/master/src/ios/KeyboardToolbarRemover.m" rel="nofollow">https://github.com/don/KeyboardToolbarRemover/blob/master/src/ios/KeyboardToolbarRemover.m</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload