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防止重用
未经允许不得转载:IDEA激活码 » UICollectionViewCell防止重用