Reputation: 25974
I need to get an event/information when CollectionView is starting and stopping dragging.
I think this must be a normal scenario when dragging cells around - to be able to save the list behind the CollectionView.
- (void)collectionView:(UICollectionView *)collectionView
moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath{
Upvotes: 1
Views: 280
Reputation: 319
use this methods to get start scrolling and end scrolling of collection view:
func scrollViewWillBeginDecelerating(_ scrollView: UIScrollView) {
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
}
Upvotes: 0
Reputation: 2822
Idea #1:
Use below two delegate methods :-
func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
}
//Method Signature Changed for Swift 3
func collectionView(UICollectionView, didEndDisplaying: UICollectionViewCell, forItemAt: IndexPath) {
}
Idea #2: 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
Check in this function:
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
}
This should work..
Cheers!
Upvotes: 2