【发布时间】:2016-12-21 20:29:31
【问题描述】:
根据 Apple 文档:
If you want to specify different sizes for your cells, you must implement the collectionView:layout:sizeForItemAtIndexPath: method on the collection view delegate. You can use the provided index path information to return the size of the corresponding item. During layout, the flow layout object centers items vertically on the same line, as shown in Figure 3-2. The overall height or width of the line is then determined by the largest item in that dimension.
现在我有一个包含 2 列和高度不同的单元格的集合视图。问题是较小的单元格以较高的单元格在其左侧/右侧居中,但不会向上浮动,而其下方的单元格也会向上浮动。
我怎样才能做到这一点?
我有什么:
我想要什么:
似乎我应该继承 UICollectionViewFlowLayout,但是我应该如何实现呢?
【问题讨论】:
-
您好,我遇到了类似的问题。我想知道您是分块加载数据还是一次加载数据?因为在 raywenderlich 教程中,他们正在一次计算整个数组。但我想分块加载数据(延迟加载)。
标签: ios swift uicollectionview uicollectionviewcell uicollectionviewlayout