Daniel Sanchez Daniel Sanchez - 4 months ago 14
iOS Question

How Do I Shorten the Pull Distance to Activate the Pull to Refresh Action in iOS 6/7?

Hey StackOverflow People,

I've been trying to figure out this question for some time now but to no avail and I need some help. I have a

UITableView
close to the bottom of my app and there's not enough screen distance for the user to engage the refresh. Does anybody know how I can shorten the distance it takes to activate the pull to refresh action (via a
UIRefreshControl
in iOS 6/7) on a
UITableView
and
UIWebView
?

Thanks in advance everyone!

Answer

As per the Apple Docs, I don't see any way to modify UIRefreshControl parameters.
link: https://developer.apple.com/library/ios/documentation/uikit/reference/UIRefreshControl_class/Reference/Reference.html

Use a third-party component like ODRefreshControl (to customize the scroll-distance in order to activate the refresh, modify the #define kMaxDistance constant).

or...

Don't use the UIRefreshControl and instead implement your own logic in the -scrollViewDidScroll method like:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if ((scrollView.contentOffset.y + scrollView.frame.size.height) >= scrollView.contentSize.height) {
        //refresh logic
    }
}