【发布时间】:2019-05-06 13:33:10
【问题描述】:
假设我们在 UICollection 视图中有 2 个部分,如下所示:
----------------- ----------------- -----------------
|header section0| 0-0 | 0-1 |footer section0
|header section1| 0-0 | 0-1 |footer section1
----------------- ----------------- -----------------
如果我要像这样添加多个部分( CollectionView 中的两列):
![屏幕截图2][2]
------------- --------------- ----------------- ----------------- ----------- -------
|header sec0| 0-0 | 0-1 |footer sec0 |header section5| 0-0 | 0-1 | footer
|header sec1| 0-0 | 0-1 |footer sec1 || |header section6| 0-0 | 0-1 | footer
|header sec2| 0-0 | 0-1 |footer sec2 || |header section7| 0-0 | 0-1 | footer
|header sec3| 0-0 | 0-1 |footer sec3 || |header section8| 0-0 | 0-1 | footer
|header sec4| 0-0 | 0-1 |footer sec4 || |header section9| 0-0 | 0-1 | footer
------------- ----------------- -----------------
我查看了文档,似乎找不到简明的答案。请帮帮我,谢谢
【问题讨论】:
-
欢迎来到这里!您是否尝试过创建自定义 UICollectionViewFlowLayout?
-
我试过了但没用,它只显示一列多节。你有什么建议吗?
-
我建议你找一个关于
UICollectionViewFlowLayout(甚至UICollectionViewLayout)子类化的教程。这绝对是解决您问题的方法。这并不难。祝你好运!
标签: ios swift collectionview