UIScrollView 上的垂直或对角滚动

发布于 2024-11-02 11:57:28 字数 114 浏览 6 评论 0原文

就我而言,方法 scrollViewDidEndDecelerating 可以检测 UIScrollView 中的水平滚动,我想知道如何检测对角线或垂直滚动​​。

In my case the method scrollViewDidEndDecelerating can detect just horizontal scrolling in UIScrollView and i want to know how to detect diagonal or vertical scrolling.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

八巷 2024-11-09 11:57:28

要检测滚动方向(例如,scrollViewDidScroll:),请查看scrollView.contentOffset.x(水平)和scrollView.contentOffset.y(垂直)相对于先前值的变化情况。如果它们都改变了,那么它就是对角滚动。

To detect the direction of the scroll in, say, scrollViewDidScroll:, look at how scrollView.contentOffset.x (horizontal) and scrollView.contentOffset.y (vertical) have changed from their prior values. If they've both changed, then it's a diagonal scroll.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文