Oleksandr Matrosov
Oleksandr Matrosov

Reputation: 27167

scrollViewDidEndDecelerating detect which collection view in action

I use this method to organize paging:

- scrollViewDidEndDecelerating

When I scroll my UICollectionView I change some content on my screen. But I have few UICollectionView on my screen and I need it just for one.

Upvotes: 7

Views: 4442

Answers (1)

Mick MacCallum
Mick MacCallum

Reputation: 130222

Well, UICollectionView inherits from UIScrollView, so you could just check which scroll view did end decelerating from within the delegate method.

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    if (scrollView == collectionViewOne) {

    }else if (scrollView == collectionViewTwo) {

    }else{
            //something else
    }
}

Upvotes: 24

Related Questions