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 6115621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:06:46+00:00 2026-05-23T15:06:46+00:00

So I just have a standard UIViewController with a UIWebView in it that displays

  • 0

So I just have a standard UIViewController with a UIWebView in it that displays a pdf. For the app functionality, I have need to be able to respond to the UIWebView’s nested UIScrollView events like scrollViewWillBeginDragging, scrollViewDidScroll, etc.

The only way I can get access to the scrollView is to (it seems like a hack) go in and get it by the subviews array:

for (id subview in webView.subviews){
    if ([[subview class] isSubclassOfClass: [UIScrollView class]])  {
        UIScrollView * s = (UIScrollView*)subview;
        s.delegate = self;
        s.tag = 1;
        scrollView = s;
    }
}

But that seems to introduce more problems than it’s worth, because I lose native UIScrollView stuff like zooming.

So to sum up what I’m needing:

What is the best way to set my UIViewController class as the delegate of the UIScrollView inside of the UIWebView? Is there something I need to do with subclassing my own UIWebView so that it handles events from it’s built in UIWebView a certain way and then pass it along somehow to the UIViewController? How does that passing thing work anyway?

Please advise!

Thank you!

  • 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-23T15:06:46+00:00Added an answer on May 23, 2026 at 3:06 pm
    1. Have you checked there is only one UIScrollView subclass in the subviews? Bung in a log in your loop to see. If there is more than one, then you’ll only pick up the last one using your code.

    2. If there is just one UIScrollView subclass, you could try saving a reference to its delegate and then in your own delegate methods passing messages on after you have done your business.

    So, in your loop, something like

    originalDelegate = s.delegate
    

    And then for the delegate methods, something like:

    - (void) scrollViewDidScroll: (UIScrollView*) scrollView;
    {
         // do your stuff
    
         [originalDelegate scrollViewDidScroll: scrollView];
    }
    

    You might need to check whether originalDelegate responds to the selector before calling it, i.e. if ([originalDelegate respondsToSelector: @selector(scrollViewDidScroll:)) etc. If it were me, I’d start by implementing all twelve delegate methods defined in the UIScrollView delegate protocol.

    Not tested this, so will be interested to know if it can be made to work. Do note, the docs explicitly say that UIWebView “should not be subclassed”

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

Sidebar

Related Questions

I've recently decided that I just have to finally learn C/C++, and there is
I have just inherited a server application, however it seems that the only copy
I have an iPhone application that is mostly using standard controls. There is one
I have an app with a UITabBarController that manages some UINavigationControllers, which in turn
I have a very large JSON string that I need to parse with in-browser
I have a new web app that is packaged as a WAR as part
I have an app that is going to navigate to a UISplitView (inside another
Just looking to be pointed in the right direction: Have standard input to a
I have a standard Django Admin page that is used to upload multiple files.
I just have started to learn Haskell and combine reading books and tutorials with

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.