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

  • Home
  • SEARCH
  • 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 8050241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:01:00+00:00 2026-06-05T07:01:00+00:00

I have an UIWebView in an UIScrollView, which is paginated. Basically I want to

  • 0

I have an UIWebView in an UIScrollView, which is paginated. Basically I want to switch between different webviews with scroll / fling gestures. Horizontally it works fine. If the webview is scrolled to the “border of the page”, the scroll/pan event is passed to the scrollview, so that the next page is shown. On the vertical axis, this does not work. There does not seem to be an event passed to the scrollview. It might be a problem with the bouncing, which I disabled, because I thought, it would consume the event. But even with bouncing disabled, this does not work.

I tested this before with TextViews in a scrollview, which worked, too. Might be a special behaviour of webviews.

Any idea, how I get this to work? Do I have to implement event listeners and pass the events manually to the scrollview?

Furthermore, if you have a better idea how to implement this kind of layout, let me know. As I said, I want to have a grid of different views, which can be changed by fling/scroll gestures. Similar to the AppStore app, where the details of an app can be scrolled vertically and the screenshots can be scrolled horizontally.

Cheers
Henrik

  • 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-06-05T07:01:01+00:00Added an answer on June 5, 2026 at 7:01 am

    So, I figured it out.

    First I set the delegate of the webview, so that I get scroll events and can check, if the webview is scrolled to top or bottom:

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        if([scrollView isEqual:webView.scrollView]) {
            float contentHeight = scrollView.contentSize.height;
            float height = scrollView.frame.size.height;
            float offset = scrollView.contentOffset.y;
    
            if(offset == 0) {
                webViewScrolledToTop = true;
                webViewScrolledToBottom = false;
            } else if(height + offset == contentHeight) {
                webViewScrolledToTop = false;
                webViewScrolledToBottom = true;
            } else {
                webViewScrolledToTop = false;
                webViewScrolledToBottom = false;
            }
    
            //NSLog(@"Webview is at top: %i or at bottom: %i", webViewScrolledToTop, webViewScrolledToBottom);
        }
    }

    Then I registered additional swipe gesture recognizers at the webview’s scrollview:

    swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeUp)];
    swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    swipeUp.delegate = self;
    [self.webView.scrollView addGestureRecognizer:swipeUp];
    [self.webView.scrollView.panGestureRecognizer requireGestureRecognizerToFail:swipeUp];
    swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeDown)];
    swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
    swipeDown.delegate = self;
    [self.webView.scrollView addGestureRecognizer:swipeDown];
    [self.webView.scrollView.panGestureRecognizer requireGestureRecognizerToFail:swipeDown];
    

    Notice the calls to [self.webView.scrollView.panGestureRecognizer requireGestureRecognizerToFail:swipeUp];. Those are absolutely necessary, because without them, the pan gesture recognizer of the webview would always consume the events, before they reach the swipe gesture recognizer. Those calls change the priorities.

    In the swipeUp and swipeDown methods, I calculate the position of the next “page” and scroll the parent scroll view to this position, if there actually is a next page.

    Last thing is, to check, if the webview is scrolled to top or bottom and only accept the gestures in that case. Therefor you have to implement the delegate of the gesture recognizer:

    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
        if(gestureRecognizer == swipeUp) {
            return webViewScrolledToBottom;
        } else if(gestureRecognizer == swipeDown) {
            return webViewScrolledToTop;
        }
    
        return false;
    }

    You might also have to disable the scroll bouncing to make this work with webpages, which are so small, that they are not scrolled at all:webView.scrollView.bounces = false;

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

Sidebar

Related Questions

I have a UIWebView in my app which I want to use to display
I have a UIWebView which inside a UIScrollView (scrollview contain another component) I tried
I have a UIWebView in which it has a UITapGestureRecognizer and basically in my
I have a UIWebView which is embedded in a UIScrollView. The webView is resized
I have a UIWebView which I want to put under my translucent UINavigationBar. Normally
I have the following situation: A UIScrollView contains a UIWebView. I want the content
I have a UIWebView that loads a link, http://www.google.com/a/datacommsales.net . But I want to
I have a UIWebView named wView. I want to use webViewDidFinishLoad: in my class,
I have a UIWebView and I have a custom font I want to load
I have a UIWebView inside UIScrollView . This idea is to be able to

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.