0
我在一個控制器中有3 collectionViews
。除了一件事以外,每個collectionView
中的一切都設置得很好,設置多個部分總是返回一個部分!UICollectionView只返回一個部分?
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
switch collectionView {
case oneCollectionView:
return 1
case twoCollectionView:
return 3
case threeCollectionView:
return 5
default:
return 10
}
}
即使我單獨設置的項目數和給予定製backgroundColors
這取決於我在哪一節。
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
switch collectionView {
case oneCollectionView:
return 25
case twoCollectionView:
return 10
case threeCollectionView:
switch section {
case 0:
return 200
case 1:
return 300
case 2:
return 5
default:
return 1
}
default:
return 1
}
}
這是每一個的CollectionView!我認爲添加標題是可行的,但也沒有產生任何結果。可能有一個原因,所有的colectionViews只顯示1節?