Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView scrolling problems when inside a UIScrollView

I have a UIScrollView (with paging) to which I add three UIViews. Each of these UIViews has a UITableView inside. So, the user should be able to scroll horizontally to the page he wants and then scroll vertically in the corresponding table.

However, some of the tables don't receive the scrolling gestures. Usually the first one does behave good, but the other ones do not. I can't select cells nor scroll the table up or down.

I used the default settings for the UIScrollView, except for these ones defined in the viewDidLoad:

- (void)viewDidLoad
{
    [super viewDidLoad];

    //Load the view controllers
    [self loadViewControllers];

    //Configure the scroll view
    self.scrollView.pagingEnabled = YES;
    self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.scrollView.frame) * viewControllers.count, CGRectGetHeight(self.scrollView.frame));
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.showsVerticalScrollIndicator = NO;
    self.scrollView.scrollsToTop = NO;
    self.scrollView.delegate = self;

    //Configure the page control
    self.pageControl.numberOfPages = viewControllers.count;
    self.pageControl.currentPage = 0;
}

I can't figure out why I can't scroll some of the tables... Any help would be greatly appreciated.

Thanks in advance!

like image 980
Sagito Avatar asked Jul 31 '13 15:07

Sagito


1 Answers

Try to set

self.scrollView.delaysContentTouches = YES;
self.scrollView.canCancelContentTouches = NO;

Maybe the UIScrollView don't pass touch informations to the subviews.

like image 156
Alberto Vitale Avatar answered Oct 28 '22 02:10

Alberto Vitale