Programatic invocations of startLoading should not cause the delegate method pullToRefreshViewDidStartLoading: to be called. This should only be called on user-initiated events.
The example in SSPullToRefreshView.h is a good example of this issue:
- (void)refresh {
[self.pullToRefreshView startLoading];
// Load data...
[self.pullToRefreshView finishLoading];
}
- (void)pullToRefreshViewDidStartLoading:(SSPullToRefreshView *)view {
[self refresh];
}
Consider the following scenario given the above code:
- View controller is sent
viewDidAppear:
refresh is called to trigger a first load
startLoading is called so that the refresh control reflects the current loading state
pullToRefreshViewDidStartLoading: is called during the state transition
refresh is called again
SSPullToRefreshView prevents that from continuing in an infinite loop, but I now have multiple instances of refresh running for what should have been a single invocation.
The only way I have found around this is to override startLoading and wrap the call to super by temporarily removing the delegate. Alternatively, any consumer is required to track loading state to prevent a single invocation of refresh from firing multiple loads.
Programatic invocations of
startLoadingshould not cause the delegate methodpullToRefreshViewDidStartLoading:to be called. This should only be called on user-initiated events.The example in SSPullToRefreshView.h is a good example of this issue:
Consider the following scenario given the above code:
viewDidAppear:refreshis called to trigger a first loadstartLoadingis called so that the refresh control reflects the current loading statepullToRefreshViewDidStartLoading:is called during the state transitionrefreshis called againSSPullToRefreshViewprevents that from continuing in an infinite loop, but I now have multiple instances ofrefreshrunning for what should have been a single invocation.The only way I have found around this is to override
startLoadingand wrap the call tosuperby temporarily removing thedelegate. Alternatively, any consumer is required to track loading state to prevent a single invocation ofrefreshfrom firing multiple loads.