How Do I Shorten the Pull Distance on UIRefreshControl to Activate the Pull to Refresh Action?

后端 未结 5 1070
傲寒
傲寒 2021-02-07 09:27

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 t

5条回答
  •  走了就别回头了
    2021-02-07 09:47

    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
        }
    }
    

提交回复
热议问题