UICollectionView calling scrollViewDidScroll: when popped from the navigation stack UICollectionView calling scrollViewDidScroll: when popped from the navigation stack ios ios

UICollectionView calling scrollViewDidScroll: when popped from the navigation stack


It seems like the only way to solve the problem is what I have already done... setting the delegate to nil before the animation.

self.collectionView.delegate = nil;

Hopefully this helps someone else in the future.


Set self.automaticallyAdjustsScrollViewInsets = NO; inside your view controller.

I had a problem similar to this, and found that on navigating away from the page, the contentOffset was changing by 20 every time.

I found that setting this property inside my view controller stopped this changing, and therefor scrollViewDidScroll was no longer being called. Turns out the view controller automatically adjusts content insets for changes in status bar, nav bar etc.. even when you navigate away.

I think this is a better solution and proper explanation as to why the scrolling method was being called.


You can try this in your controller .

[self setEdgesForExtendedLayout:UIRectEdgeNone];

Hope this would help you.