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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:36:52+00:00 2026-06-13T08:36:52+00:00

I have 3 tableviews placed upon scrollview at x = 0.0, x = 320.0

  • 0

enter image description here

I have 3 tableviews placed upon scrollview at x = 0.0, x = 320.0 and x = 640.0.
When the user horizontally swipes the tableviews (as they are on top), I want to pass the swipe event to its superview and when the user vertically swipes tableviews the tableview must scroll vertically.

How can I achieve this?

  • 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-13T08:36:53+00:00Added an answer on June 13, 2026 at 8:36 am

    To pass the touch from UIScrollView, use this code as a category:

    @implementation UIScrollView (FixedApi)
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
        UITouch *touch = [[event allTouches] anyObject];
    
        NSLog(@"touch view = %@", [[touch view].class description]);
        if ([[[touch view].class description] isEqualToString:@"UITableViewCellContentView"]) {
            //To pass the touch to UITableViewCell
        } else if ([[[touch view].class description] isEqualToString:@"UITableView"] && isHorizntalSCroll == true && pageNumber == 2) {
            //To pass the touch to UITableView
    
        } else if ([[[touch view].class description] isEqualToString:@"UIView"]) {
            //To pass the touch to UIView
        } else {
        [self.superview touchesBegan:touches withEvent:event]; // or 1 nextResponder, depends
        [super touchesBegan:touches withEvent:event];
        }
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        if ( !self.dragging ) [self.nextResponder.nextResponder touchesEnded:touches withEvent:event];
        [super touchesEnded:touches withEvent:event];
    }
    
    @end
    

    To determine the vertical/Horizontal scrolling, you can use this code:

    .h file <UIScrollViewDelegate>

    BOOL pageControlIsChangingPage;
    CGPoint startPos;
    int     scrollDirection;
    int CX; //The width of the pages.
    BOOL isHorizntalSCroll;
    int pageNumber;
    

    .m file

    #pragma mark -
    #pragma mark UIScrollViewDelegate stuff
    - (void)scrollViewDidScroll:(UIScrollView *)_scrollView {
        if (scrollDirection==0){//we need to determine direction
            //use the difference between positions to determine the direction.
            if (abs(startPos.x-scrollView.contentOffset.x)<abs(startPos.y-scrollView.contentOffset.y)){          
                NSLog(@"Vertical Scrolling");
                scrollDirection=1;
                isHorizntalSCroll = false;
                [scrollView setPagingEnabled:NO];
            } else {
                NSLog(@"Horitonzal Scrolling");
                scrollDirection=2;
                isHorizntalSCroll = ture;
                [scrollView setPagingEnabled:YES];
            }
        }
    
        if (scrollDirection==1) {
            [scrollView setContentOffset:CGPointMake(startPos.x,scrollView.contentOffset.y) animated:NO];
        } else if (scrollDirection==2){
            [scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x,startPos.y) animated:NO];
        }
    }
    
    - (void)scrollViewDidEndDecelerating:(UIScrollView *)_scrollView {
        if (pageControlIsChangingPage) {
            return;
        }
    
        CGFloat pageWidth = _scrollView.frame.size.width;
        int page = floor((_scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
        pageControl.currentPage = page;
        pageNumber = page;
        NSLog(@"page number = %d",page);
        if (page == 3 || page == 0) {
            [scrollView setContentSize:CGSizeMake(CX, personalInfo.frame.size.height + 100)];
        } else {
            [scrollView setContentSize:CGSizeMake(CX, [scrollView bounds].size.height)];
        }
    
        pageControlIsChangingPage = NO;
    }
    
    #pragma mark -
    #pragma mark PageControl stuff
    - (IBAction)changePage:(id)sender {
        /*
         *  Change the scroll view
         */
        CGRect frame = scrollView.frame;
        frame.origin.x = frame.size.width * pageControl.currentPage;
        frame.origin.y = 0;
    
        [scrollView scrollRectToVisible:frame animated:YES];
    
        /*
         *  When the animated scrolling finishings, scrollViewDidEndDecelerating will turn this off
         */
        pageControlIsChangingPage = YES;
    }
    
    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollViews{
        startPos = scrollView.contentOffset;
        scrollDirection=0;
    }
    
    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollViews willDecelerate:(BOOL)decelerate {
        if (decelerate) {
            scrollDirection=3;
        }
    }
    

    That’s it,

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

Sidebar

Related Questions

I have an app which contains a scrollview with several tableviews. Each tableview is
I have UINavigationController and I`ve placed UIListView in it. Now I want to add
I have 2 tableViews, the first one is the Main table and the second
I have an app with an UINavigationController and two tableviews. When I switch between
Currently I have Long Pres Gesture Recognizers on four different TableViews (two in each
I have two table views, when user clicks one cell of the first, second
I have a tableview, and whenever I swipe a row in section A and
I have a table view placed in a navigation controller. Cells of the table
I am developing an iPhone application, in a view, I have placed UITextView and
I have three UITableViews that should look identical. Each is placed inside a different

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.