14

I've got a UIRefreshControl at the top of my table.

The screen is in landscape.

The trouble is, I can't pull down far enough in order to trigger the refresh, because there is too little space in Landscape. Is there a way to adjust the amount you have to pull down?

cannyboy
  • 24,180
  • 40
  • 146
  • 252
  • Very interested in discovering the root cause of this issue. Unable to reproduce in Xcode 4.5 on OS X 10.8.2 – Zelko Oct 07 '12 at 17:18
  • 4
    my app has a navigation bar, as well as a UISearchBar at the top of the table, so there is less room to pull – cannyboy Oct 08 '12 at 16:09
  • If you only have a nav bar and a search bar then fair enough, sounds like this should work as expected. The Mail app has search bar and nav bar, works fine there, what else do you have in your screen ? – Daniel Oct 10 '12 at 20:15
  • how else did you achieve the effect? what property did you change – Anand Dec 07 '12 at 11:15
  • `UIRefreshControl` wasn't supported by `UIScrollView` prior **iOS 10**. The drift disappears when using `refreshControl`. See [SO 29791995](http://stackoverflow.com/a/43288926/218152) and [GitHub SO-29791995](https://github.com/SwiftArchitect/SO-29791995) demo – SwiftArchitect Apr 08 '17 at 00:56
  • I have found a solution for this problem https://stackoverflow.com/a/55594743/1296280 – Arbitur Apr 09 '19 at 14:05

3 Answers3

12

Remember that your tableview is just a subclass of UIScrollView. In your controller, implement scrollViewDidScroll method and call -beginRefreshing on your UIRefreshControl like below.

But the animation of the UIRefreshControl while going to refreshing state wont be as smooth as you would expect. But it works.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y < -98 && ![self.refresher isRefreshing]) {
        [self.refresher beginRefreshing];
        //do all the work
        [self.refresher endRefreshing];
    }
}
Anand
  • 10,310
  • 24
  • 90
  • 135
10

The way you can adjust how far you have to pull is by altering the height of the UITableView. UIRefreshControl adjusts its maximum distortion height proportionally to the height of the tableView. If you can't change the height of the tableView, then please file a bug with the details of your situation and it will hopefully be addressed in a future iOS release.

Also, have you tried pulling down more quickly?

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
0

if your contentsizehas the height is not enough to pull down, you might need to enable its vertical by using self.collectionView.alwaysBounceVertical = YES;

Nghia Luong
  • 790
  • 1
  • 6
  • 11