如何在 UIScrollView 中嵌套 UIScrollView,以便用户可以滚动内部 UIScrollView?

How can I nest a UIScrollView inside a UIScrollView, so that the user can scroll the inner UIScrollView?(如何在 UIScrollView 中嵌套 UIScrollView,以便用户可以滚动内部 UIScrollView?)
本文介绍了如何在 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

iOS UIScrollView Lazy Loading(iOS UIScrollView 延迟加载)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可缩放?)
How can i add more than 10 buttons on a navigationbar in iphone application development?(如何在 iphone 应用程序开发中的导航栏上添加 10 多个按钮?)
Using UITouch inside a UIScrollView(在 UIScrollView 中使用 UITouch)
UitextField resignFirstResponder does not work in scroll view(UitextField resignFirstResponder 在滚动视图中不起作用)
laying out images in UIScrollView automatically(自动在 UIScrollView 中布局图像)