I'm using a UICollectionView
to scroll through a set of thumbnails quickly. Once scrolling ends, I'd like to display a larger hi-res version of the current thumbnail.
How can I detect when the user has completed scrolling? I do implement didEndDisplayingCell
, but that only tells me when a particular cell has scrolled off; it doesn't tell me when the scroll motion actually completes.
scrollViewDidScroll only notifies you that the scroll view did scroll not that it has finished scrolling. The other method scrollViewDidEndScrollingAnimation only seems to fire if you programmatically move the scroll view not if the user scrolls.
So if you have set the delegate and implemented UIScrollViewDelegate , you should be able to detect this the same way as UIScrollView . - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; As per documentation, the above method should tell when the scroll view has ended decelerating the scrolling movement.
UIScrollViewDelegate. scrollViewDidScroll(_:) A change in the accessibility focus that triggers an automatic scrolling also triggers a call to scrollViewDidScroll(_:) in your UIScrollViewDelegate. Use that to counter the automatic scrolling effect, f.i. by setting contentOffset the way you prefer it.
An object that manages an ordered collection of data items and presents them using customizable layouts.
NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionView : UIScrollView
UICollectionView
is a subclass of UIScrollView
. So if you have set the delegate and implemented UIScrollViewDelegate
, you should be able to detect this the same way as UIScrollView
.
For eg:-
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
As per documentation, the above method should tell when the scroll view has ended decelerating the scrolling movement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With