【发布时间】:2019-05-22 20:57:06
【问题描述】:
因为我是初学者,所以我遇到的问题可能不是那么专业。
我的应用中有两个原型集合视图单元格,我们称它们为 Cell1 和 Cell2,它们都在同一个部分中。
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell1", for: indexPath) as? customCell {
return cell
} else if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell2", for: indexPath) as? customCell {
return cell
}
return UICollectionViewCell()
}
我的问题从这里开始:
在numberOfItemsInSection 中,我想说例如从原型Cell1 绘制3 个单元格,从Cell2 绘制5 个单元格。
我不知道如何在两个原型之间划分单元数,有人可以帮我吗?
【问题讨论】:
标签: swift uitableview uicollectionview