UICollectionViewstream布局没有固定的行高
如何修改stream布局,以便在较小和较大的单元格之间具有相同的垂直间距(例如,没有固定的行高度/行高度不固定到最大尺寸)?
我想看这个样子
解决scheme是使用UICollectionViewWaterfallLayout
按照网站的设置,你可以像这样设置
- (void)viewDidLoad { [super viewDidLoad]; UICollectionViewWaterfallLayout * layout = (UICollectionViewWaterfallLayout *)self.collectionView.collectionViewLayout; layout.delegate = self; layout.columnCount = 2; layout.itemWidth = 150.f; layout.sectionInset = UIEdgeInsetsZero; ... }