2016-01-26 137 views

回答

2

如果您在代碼中初始化您的集合視圖,請將自定義流佈局傳遞到init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout)。之後您也可以設置collectionViewLayout

+0

如何爲第2節設置customFlowLayout僅當我在collectionview中有2節時? –

0

在的ObjectiveC:

UICollectionView *collectionView = [[UICollectionView alloc] init]; 

collectionView.collectionViewLayout = YOURCustomLayout; 

或者乾脆:

UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:YOURFrame collectionViewLayout:YOURCustomLayout]; 

爲雨燕檢查@Lumialxk回答。

相關問題