samvermette / SVPullToRefresh

Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.
http://samvermette.com/314
MIT License
4.82k stars 1.09k forks source link

Doesn't work for second time for Collection view #258

Open eramitkumarsoni opened 9 years ago

eramitkumarsoni commented 9 years ago

Hi, First of all i would like to thank to share this wonderful Code. I have implemented the same on Collection view for first scroll it works proper but when i do the scroll for second time it doesn't call the function again.

I just have written in my code is

__weak MyClassName *weakSelf = self; [self.collectionView addInfiniteScrollingWithActionHandler:^{ [weakSelf parseAfterScroll]; }];

pjryan93 commented 9 years ago

You need to call [self.collectionView.infiniteScrollingView stopAnimating];

The problem is the state of InfitieScorllView is not being updated to stopped. It will not trigger the action handler unless the state is set to stopped. Calling stopAnimating after your action handler is completed resets the state.