UIRefreshControl in Landscape

2020-02-10 14:41发布

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?

3条回答
Fickle 薄情
2楼-- · 2020-02-10 14:46

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?

查看更多
地球回转人心会变
3楼-- · 2020-02-10 14:58

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];
    }
}
查看更多
别忘想泡老子
4楼-- · 2020-02-10 15:04

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

查看更多
登录 后发表回答