具有水平分页和垂直滚动的UICollectionView

时间:2021-12-16 19:00:54

Is it possible to have a collection view with horizontal paging, as well as vertical scrolling?

是否可能有一个具有水平分页和垂直滚动的集合视图?

I would like to have the effect of pages of collection views, where the content can be scrolled vertically, say 20 items, with 5 visible at a time. I would also like to support pages horizontally which also hold 20 items, 5 visible at a time.

我希望具有集合视图页面的效果,其中内容可以垂直滚动,比如20个项目,每次可以看到5个项目。我还想水平地支持页面,它也包含20个项目,每次可以看到5个项目。

Is a single collection view able to handle this or should it be a scrollview with paging, containing collectionviews? That seems a bit weird and the gestures would interfere.

一个集合视图能够处理这个问题吗?或者它应该是一个包含分页的scrollview,包含集合视图吗?这似乎有点奇怪,而且手势会干扰。

Currently I am only able to page in one direction, which stops scrolling in the other direction.

目前我只能在一个方向上进行页面浏览,这个方向会停止在另一个方向上滚动。

3 个解决方案

#1


1  

ok you want to make interface like Netflix app there is a lot of tutorial available to achieve this here is the link

好的,你想要制作像Netflix应用这样的界面这里有很多教程可以实现这个链接

1.https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/

1. https:/ /ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/

2.http://www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/

2. http:/ /www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/

the above tutorial helped me. and i had given an answer to similar type question

上面的教程帮助了我。我也回答了类似的问题

Swift - how to open another viewcontroller with CollectionViewCell inside UITableViewCell

Swift -如何在UITableViewCell中使用CollectionViewCell打开另一个viewcontroller

#2


0  

I would consider nesting cells. In your paging UICollectionView Have a cell for each column and then in each cell have another UICollectionView that scrolls vertically only.

我将考虑嵌套单元格。在分页UICollectionView中,每个列都有一个单元格,而每个单元格中又有一个UICollectionView,它只垂直滚动。

#3


0  

I was recently developing a keyboard and wanted to add an emoticon keyboard, which needed the same sort of implementation as you're describing as i wanted the emoticons to be categorised and scrollable both ways. I found that a collection view inside of collection view worked the best for me.

我最近开发了一个键盘,想要添加一个表情符号键盘,它需要和你描述的一样的实现,就像我希望表情符号可以被分类和滚动一样。我发现collection视图内部的collection视图最适合我。

This guy wrote a great article that should get you started ashfurrow uicollectionview in a uitableviewcell

这个人写了一篇很棒的文章,应该能让你在uitableviewcell中创建ashfurrow uicollectionview

#1


1  

ok you want to make interface like Netflix app there is a lot of tutorial available to achieve this here is the link

好的,你想要制作像Netflix应用这样的界面这里有很多教程可以实现这个链接

1.https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/

1. https:/ /ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/

2.http://www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/

2. http:/ /www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/

the above tutorial helped me. and i had given an answer to similar type question

上面的教程帮助了我。我也回答了类似的问题

Swift - how to open another viewcontroller with CollectionViewCell inside UITableViewCell

Swift -如何在UITableViewCell中使用CollectionViewCell打开另一个viewcontroller

#2


0  

I would consider nesting cells. In your paging UICollectionView Have a cell for each column and then in each cell have another UICollectionView that scrolls vertically only.

我将考虑嵌套单元格。在分页UICollectionView中,每个列都有一个单元格,而每个单元格中又有一个UICollectionView,它只垂直滚动。

#3


0  

I was recently developing a keyboard and wanted to add an emoticon keyboard, which needed the same sort of implementation as you're describing as i wanted the emoticons to be categorised and scrollable both ways. I found that a collection view inside of collection view worked the best for me.

我最近开发了一个键盘,想要添加一个表情符号键盘,它需要和你描述的一样的实现,就像我希望表情符号可以被分类和滚动一样。我发现collection视图内部的collection视图最适合我。

This guy wrote a great article that should get you started ashfurrow uicollectionview in a uitableviewcell

这个人写了一篇很棒的文章,应该能让你在uitableviewcell中创建ashfurrow uicollectionview