UICollectionView在两个方向上滚动 [英] UICollectionView scrolling in both directions

查看:337
本文介绍了UICollectionView在两个方向上滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用垂直滚动制作了 UICollectionView

I made a UICollectionView with a vertical scroll.

单元格的宽度大于屏幕宽度,因此我根据<$创建了 customFlowLayout c $ c> UICollectionViewFlow 布局返回正确计算的内容大小。

The width of the cell is more than than the screen width, so I created a customFlowLayout based on UICollectionViewFlow layout returning the right calculated content size.

然而,这不起作用。当单元格的宽度小于屏幕宽度时,它可以工作。是否意味着我们在垂直滚动中宽度不能超过屏幕宽度?

However, this doesn't work. When the width of the cell is less than the screen width it works. Does it mean that we can't have width more than than screen width in vertical scroll?

水平滚动的宽度相同,但是<$的高度相同c $ c> CollectionView 仅限于屏幕高度。

It is the same for horizontal scroll, but then the height of the CollectionView is limited to screen height.

有什么办法让它有效吗?

Is there any way to make it work?

推荐答案

我发现这是 UICollectionView:如何定义支持水平和垂直滚动的UICollectionViewLayout?

Jirune提供的示例似乎是关键。但是如果可以使用collectionview行而不是行的部分那么它会很好..

the example provided by Jirune seems to be the key. But if it possible to use collectionview rows instead of sections for rows it would be nice..

这篇关于UICollectionView在两个方向上滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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