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

Ask A Question

Stats

  • Questions 398k
  • Answers 398k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the end I had to use something like this,… May 15, 2026 at 3:43 am
  • Editorial Team
    Editorial Team added an answer Just found the solution, you can find it here: http://developers.facebook.com/docs/api#search… May 15, 2026 at 3:43 am
  • Editorial Team
    Editorial Team added an answer It's technically an invalid warning in your case, but it's… May 15, 2026 at 3:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.