Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 647275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:42:16+00:00 2026-05-13T21:42:16+00:00

It looks like a problem which could have simple solution, but I haven’t found

  • 0

It looks like a problem which could have simple solution, but I haven’t found anything what could lead the way to it. I’m using UIWebView inside of UIScrollView and tapping on statusBar (to scroll content to top) is not working.

I’ve made simple test application to see if it’s really UIWebViews fault. And it really is.

//  scrolls to top on status bar tap 
UIScrollView *sv = [[UIScrollView alloc] init];
sv.frame = CGRectMake(0, 0, 320, 480);
sv.contentSize = CGSizeMake(320, 1200);
[self.view addSubview:sv];

// doesn't scroll
UIScrollView *sv = [[UIScrollView alloc] init];
sv.frame = CGRectMake(0, 0, 320, 480);
sv.contentSize = CGSizeMake(320, 1200);

UIWebView *wv = [[UIWebView alloc] init];
wv.frame = CGRectMake(0, 0, 320, 100);
[sv addSubview:wv]; 

[self.view addSubview:sv];

So, I think maybe there’s something I could disable to make UIWebView not to mess with scrollToTop? Or some kind of workaround also would be nice.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:42:16+00:00Added an answer on May 13, 2026 at 9:42 pm

    I ran into this last night until I finally found the answer buried in a comment to a comment. The idea of that original post is that when you add the UIWebView to your UIScrollingView, you use the following:

    - (void) ensureScrollsToTop: (UIView*) ensureView {
        ((UIScrollView *)[[webView subviews] objectAtIndex:0]).scrollsToTop = NO;
    }
    

    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:

    Class List:
        Class = UIScroller
        Class = UIView
        Class = UIResponder
        Class = NSObject
    Supported Methods:
        ...
        Method _scrollToTop
        Method setScrollsToTop:
        Method scrollsToTop
        ...
    Supported Properties:
        Property scrollsToTop
    

    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:

    - (void)webViewDidFinishLoad:(UIWebView *) wv {    
        [self ensureScrollsToTop: wv];
    }
    

    EDIT #2:

    now, in iOS 5, as noted in iPhone OS: Tap status bar to scroll to top doesn’t work after remove/add back use UIWebView’s new @property scrollView, making ensureScrollsToTop implementation unnecessary for projects that aren’t using deployment targets lower than iOS 5.0 .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The symptom of the problem looks like [0m[27m[24m[J[34;1 which on a terminal translates into
I have a model that looks something like this: public class SampleModel { public
Looks like here in StackOveflow there is a group of F# enthusiasts. I'd like
Looks like my only option is to create a mutatant child of the tree
It looks like we'll be adding CAPTCHA support to Stack Overflow. This is necessary
Update : Looks like the query does not throw any timeout. The connection is
It looks like I had a fundamental misunderstanding about C++ :< I like the
:vimgrep looks like a really useful thing. Here's how to use it: :vim[grep][!] /{pattern}/[g][j]
It looks like the standard asp.net 2 RangeValidator control doesn't allow times. e.g. 01/01/2008
It looks like the run-time compiler doesn't support the same language as the command-line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.