I have UICollectionView inside UITableViewCell. I wanted to enable or disable scrolling of UICollectionView and UITableView based on contentOffset of both. For example, inside UICollectionView's ViewController I have a code -
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y == 0) {
_collectionView.scrollEnabled = false;
// This will enable _tableView scroll which is implemented in UITableView's ViewController
[_delegate toggleScroll:true];
} else {
_collectionView.scrollEnabled = true;
// This will disable _tableView scroll which is implemented in UITableView's ViewController
[_delegate toggleScroll:false];
}
}
But enabling the scroll does not effect immediately. First scroll does not enable or disable _collectionView but on second scroll it works as expected. Can't we enable the scroll on the fly(Only on one swipe/scroll)?