Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here you go, I'm using this in an app I'm currently developing. Fingers crossed that it gets to the app store, although going on other 'hacks' that make it to the store this is no worse than others, so should stand a fair chance. </p> <p>No annoying side effects with this method - it cleanly removes the bar by making sure it's never created in the first place. Ta da!</p> <p>Credit goes to <a href="https://gist.github.com/2048571">https://gist.github.com/2048571</a>, this is his code with a small fix.</p> <pre><code>#import &lt;objc/runtime.h&gt; #import &lt;UIKit/UIKit.h&gt; @interface UIWebView (HackishAccessoryHiding) @property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView; @end @implementation UIWebView (HackishAccessoryHiding) static const char * const hackishFixClassName = "UIWebBrowserViewMinusAccessoryView"; static Class hackishFixClass = Nil; - (UIView *)hackishlyFoundBrowserView { UIScrollView *scrollView = self.scrollView; UIView *browserView = nil; for (UIView *subview in scrollView.subviews) { if ([NSStringFromClass([subview class]) hasPrefix:@"UIWebBrowserView"]) { browserView = subview; break; } } return browserView; } - (id)methodReturningNil { return nil; } - (void)ensureHackishSubclassExistsOfBrowserViewClass:(Class)browserViewClass { if (!hackishFixClass) { Class newClass = objc_allocateClassPair(browserViewClass, hackishFixClassName, 0); IMP nilImp = [self methodForSelector:@selector(methodReturningNil)]; class_addMethod(newClass, @selector(inputAccessoryView), nilImp, "@@:"); objc_registerClassPair(newClass); hackishFixClass = newClass; } } - (BOOL) hackishlyHidesInputAccessoryView { UIView *browserView = [self hackishlyFoundBrowserView]; return [browserView class] == hackishFixClass; } - (void) setHackishlyHidesInputAccessoryView:(BOOL)value { UIView *browserView = [self hackishlyFoundBrowserView]; if (browserView == nil) { return; } [self ensureHackishSubclassExistsOfBrowserViewClass:[browserView class]]; if (value) { object_setClass(browserView, hackishFixClass); } else { Class normalClass = objc_getClass("UIWebBrowserView"); object_setClass(browserView, normalClass); } [browserView reloadInputViews]; } @end </code></pre>
 

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