【发布时间】:2021-04-13 18:27:48
【问题描述】:
在 Xcode 中将构建目标更新为 iOS 14 后,不会调用 cellForItemAt。但是, numberOfItemsInSection 被调用,但 cellForItemAt 却没有,这很奇怪。我以前从未见过。
知道它可能是什么吗?
extension LoginTableCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.cells.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LoginCollectionCell",
return cell
}
【问题讨论】:
-
首先检查 self.cells 中元素的数量。这通常是问题所在:一个空数组
标签: swift uicollectionview ios14