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节?