Reputation: 1613
I implemented the ego table view pull to refresh mechanism into my iphone app. When i first implemented it, the pull to refresh worked perfectly. However as of recently, it seems like the pull mechanism is too sensitive.
For example when im scrolling really quickly and i get to the bottom, I should have to pull for at least 1 or 2 full seconds before the mechanism realizes i want to refresh. However even if i pull it for like .2 seconds, the mechanism loads more.
I don't know if my question makes sense, but basically i'm wondering if there's a way to alter the code in ego table view pull refresh to not refresh unless i pull up for a longer period of time
Upvotes: 0
Views: 1409
Reputation: 69027
By looking at the implementation of EGOTableViewPullRefresh
(egoRefreshScrollViewDidEndDragging
selector), it does not seem that it is a question of elapsed time. it is simply the amplitude of the drag (>65 px) that will trigger the reload.
You could easily modify the code and track the time passed between the start of the dragging and the end, though. Just replace the condition:
if (scrollView.contentOffset.y <= - 65.0f && !_loading) {
with the appropriate one base on the elapsed time.
Upvotes: 1
Reputation: 63667
I'm not familiar with that component, but here is an idea:
// when refresh condition is met (you scrolled beyond the bottom boundary)
[self performSelector:@selector(yourRefreshMethod) withObject:nil afterDelay:2.0];
// when refresh condition is not met (you scrolled back to the normal boundary)
[NSObject cancelPreviousPerformRequestsWithTarget:self];
This forces you to scroll beyond the bottom for 2 seconds to initiate a refresh. I guess that component has some kind of refresh detection that you can use with this snippet.
Upvotes: 0