samedi 1 août 2015

UITableView inside UIScrollView, scroll not working

I'm trying to implement the following hierarchy

-- UISCrollView
  -- ContainerView
    -- UITableView

Initial stage

Initially the UITableView scroll is disabled. When the UICollectionView reaches a particular contentOffset of the UIScrollView, I implement this :

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{

    if (scrollView.contentOffset.y >= 140)
    {
        [scrollView setContentOffset:CGPointMake(0, 140) animated:NO];
    }
}

After Scrolling

All this works as intended, but now the UIScrollView is eating the scroll of the UITableView. The scroll of UITableView is erratic now and doesn't scroll properly. The scroll of UITableView happens only after 7-8 attempts and then it stops again.

What might be the reason of this behaviour? I tried setting myScrollView.scrollEnabled = NO inside scrollViewDidScroll and no luck.

Aucun commentaire:

Enregistrer un commentaire