UICollectionViewCell防止重用
作者:
雷霸龙 | 来源:发表于
2019-07-31 16:56 被阅读0次func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let identifier = "cell"
collectionView.register(RescueProjectCell.self, forCellWithReuseIdentifier: identifier)
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! RescueProjectCell
// 此处可起到防止重用的作用
for view in cell.contentView.subviews {
view.removeFromSuperview()
}
return cell
}
本文标题:UICollectionViewCell防止重用
本文链接:https://www.haomeiwen.com/subject/vtvtdctx.html
网友评论