如何在UIScrollView内嵌套UIScrollView,以便用户可以滚动内部UIScrollView? [英] How can I nest a UIScrollView inside a UIScrollView, so that the user can scroll the inner UIScrollView?

查看:256
本文介绍了如何在UIScrollView内嵌套UIScrollView,以便用户可以滚动内部UIScrollView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有尝试,但我认为,一旦我知道用户将要在子滚动视图中滚动,我将不得不禁用父滚动视图的滚动,右?

I haven't tried that yet, but I assume that I would have to disable scrolling of the parent scroll view as soon as I know that the user will want to scroll in the child scroll view, right?

两个滚动视图均水平滚动。

Both scroll views are scrolling horizontal.

如何暂时禁用父项的滚动检测?或者有其他方法吗?

How could I disable scrolling detection of the parent temporarily? Or is there some other way?

推荐答案

UIScrollView有一个属性 scrollEnabled ,您可以将其设置为 NO ,以禁用父滚动视图中的滚动。

UIScrollView has a property called scrollEnabled, which you can set to NO to disable scrolling in your parent scroll view.

它还是,但你可能只是发现它做正确的事情,即内部滚动视图滚动,直到它不能再滚动,此时外部滚动视图滚动。

I haven't tried it yet, but you may just find that it Does The Right Thing, i.e., the inner scroll view scrolls until it can't scroll any more, at which point the outer scroll view scrolls.

这篇关于如何在UIScrollView内嵌套UIScrollView,以便用户可以滚动内部UIScrollView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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