【发布时间】:2015-11-27 22:13:37
【问题描述】:
我有一个故事板,由单个 UICollectionView 和多个单元格组成,每个单元格的高度各不相同。第一个单元格的高度来自UICollectionViewDelegateFlowLayout:
func collectionView(collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
.. 但我希望第二个单元格更短。
我在单元格内的“主”UIStackView 中放置了两个UIStackViews,每个内部UIStackViews 都有一个或多个标签,如下所示:
cell
--> stackView (master)
--> stackView (1)
--> label
--> stackView (2)
--> label
--> label (etc)
.. 希望UIStackView 会使单元格高度动态化,但事实并非如此。它像以前一样从UICollectionViewDelegateFlowLayout 获取高度。
我应该怎么做?
【问题讨论】:
标签: ios swift uicollectionview uistackview