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

fix cash on Observing #256

Open captain-black opened 9 years ago

captain-black commented 9 years ago
    if (self.infiniteScrollingView.isObserving) {
        [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentOffset"];
        [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentSize"];
        [self.infiniteScrollingView resetScrollViewContentInset];
        self.infiniteScrollingView.isObserving = NO;
    }

[self.infiniteScrollingView resetScrollViewContentInset]; will make scrolling and trigger this method again.

you should do: if (self.infiniteScrollingView.isObserving) { self.infiniteScrollingView.isObserving = NO; [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentOffset"]; [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentSize"]; [self.infiniteScrollingView resetScrollViewContentInset]; }

This kind of BUG is also in the other method, fix them like above

liuxuan30 commented 9 years ago

you are welcome to pull a request. This project has stopped updating for a long time. You can fix it in your branch.

LawrenceHan commented 7 years ago

https://github.com/LawrenceHan/SVPullToRefresh