Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ran into this last night until I finally found the answer buried in a comment to a comment. The <a href="https://stackoverflow.com/questions/1361614/iphone-os-tap-status-bar-to-scroll-to-top-doesnt-work-after-remove-add-back/1629865#1629865">idea of that original post</a> is that when you add the UIWebView to your UIScrollingView, you use the following:</p> <pre><code>- (void) ensureScrollsToTop: (UIView*) ensureView { ((UIScrollView *)[[webView subviews] objectAtIndex:0]).scrollsToTop = NO; } </code></pre> <p>This seemed fishy to me since the first sub-view of a UIWebView claims to be a UIScroller which is not a subclass of UIScrollView. However, since UIScroller supports the scrollsToTop property, the cast just gives us a way past the compiler warning:</p> <pre> Class List: Class = UIScroller Class = UIView Class = UIResponder Class = NSObject Supported Methods: ... Method _scrollToTop Method setScrollsToTop: Method scrollsToTop ... Supported Properties: Property scrollsToTop </pre> <p>EDIT: Just another quick note about where this actually needs to occur: in the webViewDidFinishLoad callback. Calling it on UIWebView construction isn't good enough because at that time the UIWebView hasn't created it's child views yet, which are the ones causing the problem:</p> <pre><code>- (void)webViewDidFinishLoad:(UIWebView *) wv { [self ensureScrollsToTop: wv]; } </code></pre> <p>EDIT #2:</p> <p>now, in iOS 5, as noted in <a href="https://stackoverflow.com/a/6549501/774691">iPhone OS: Tap status bar to scroll to top doesn't work after remove/add back</a> use UIWebView's new @property scrollView, making <code>ensureScrollsToTop</code> implementation unnecessary for projects that aren't using deployment targets lower than iOS 5.0 .</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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