[英]Pass scroll between UIScrollView and embed UICollectionView
Here's my architecture. 这是我的建筑。
I have a UIScrollView
with some UIView's added in. At the end on my scrollview i have a UICollectionView
(embedded in my scrollview) in which i loads many data. 我有一个添加了一些UIView的UIScrollView
。在我的滚动视图的最后,我有一个UICollectionView
(嵌入在我的滚动视图中),在其中加载了许多数据。 I had to use a UICollectionView
in order to reuse the multiple views displayed. 我必须使用UICollectionView
才能重用显示的多个视图。
What i want is keep a smooth scroll when the user scrolls to the bottom of the parent scrollview and continue scrolling in the UICollectionView
. 我想要的是当用户滚动到父scrollview的底部并继续在UICollectionView
滚动时保持平滑滚动 。
What i've made now is set the size of my UICollectionView
equal to my UIScrollView
Size and i've disabled bounces on both. 我现在所做的是将UICollectionView
的大小设置为等于UIScrollView
大小,并且禁用了两者的弹跳。
But i can't have a smooth scroll. 但是我不能顺利滚动。 When i reach the end of my UIScrollView
, the scrollview's stop and then i have to re scroll on my UICollectionView
当我到达UIScrollView
的末尾时,scrollview的停止,然后我必须在UICollectionView
上重新滚动
Not sure if it's really clear. 不确定是否很清楚。
You should not normally "pass scroll" between elements. 通常,您不应该在元素之间“通过滚动”。 What you need to make sure is that the UICollectionView
's frameSize is equal to its contentSize, meaning its frameSize expands as much as its contents so that all of its content is visible without having to scroll. 您需要确保UICollectionView
的frameSize等于它的contentSize,这意味着它的frameSize会与其内容一样扩展,以便其所有内容可见而无需滚动。 Then your UIScrollView
will handle the scroll and show the contents of your UIViewController
by scrolling just itself. 然后,您的UIScrollView
将处理滚动并通过仅滚动自身来显示UIViewController
的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.