使用 UIRefreshControl 拖动 UITableView 的距离 [英] UITableView dragging distance with UIRefreshControl

查看:45
本文介绍了使用 UIRefreshControl 拖动 UITableView 的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UITableView 上实现 UIRefreshControl 时遇到了一些问题.

I'm having some trouble on implementing a UIRefreshControl on a UITableView.

一切正常,除了我必须滚动屏幕的 80% 才能触发 UIRefreshControl.有时我什至无法触发它,因为屏幕底部有一个标签栏,当手指到达它时会取消滚动移动.

Everything is working fine except the fact that I have to scroll something like 80% of the screen for the UIRefreshControl to get triggered. Sometimes I'm not even able to trigger it since there is a tab bar on the bottom of the screen, which cancels the scrolling movement when the finger reaches it.

我看过其他应用程序,即 Apple 的Mail",其中 UIRefreshControl 在仅滚动 30% 屏幕后触发.

I've looked at other apps, namely Apple's 'Mail', where the UIRefreshControl is triggered after scrolling only 30% of the screen.

我错过了什么?真的需要这方面的帮助!

What am I missing? Really need help on this one!

提前致谢

推荐答案

我遇到了类似的问题,很可能这与您的原因相同.对我来说,我隐藏了滚动指示器,使我无法看到问题的明显原因:UIScrollView 的高度远大于它的 superView...

I had a similar problem and it's quite possible that's the same cause for you. For me happens that I hided the scroll indicator making me unable to see the obvious cause of the problem: the UIScrollView's height is much greater than its superView...

仔细检查你的 UIScrollView 的高度,因为拖动距离"它只是那个高度的一个百分比.UITableView 也是如此,因为它是 UIScrollView 的子类.

Double check your UIScrollView's height because the "dragging distance" it's just a percentage of that height. Same goes for UITableView too, since it's a child class of UIScrollView.

似乎这不是重现此问题的唯一方法,因为触发复习所需的拖动距离是以错误的方式计算的.有关详细信息,请参阅这个问题.

Seems that this isn't the only way to reproduce this problem, since the required drag distance to trigger the refresher is calculated in a buggy way. Refer to this question for more info.

但一般来说,如果您的 UIScrollView 的高度与其父容器(例如屏幕本身)不同,就会发生这种情况.

But in general it will happen if your UIScrollView's height is different than his parent container (e.g the screen itself).

这篇关于使用 UIRefreshControl 拖动 UITableView 的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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