风景中的UIRefreshControl [英] UIRefreshControl in Landscape

查看:83
本文介绍了风景中的UIRefreshControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子顶部有一个UIRefreshControl。

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

屏幕处于横向状态。

麻烦的是,我无法按顺序拉下来触发刷新,因为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?

推荐答案

请记住,你的tableview只是UIScrollView的子类。在您的控制器中,实现 scrollViewDidScroll 方法并在UIRefreshControl上调用 -beginRefreshing ,如下所示。

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

但是UIRefreshControl的动画在进入刷新状态时不会像你期望的那样顺畅。但它确实有效。

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

这篇关于风景中的UIRefreshControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆