// ?1、在創(chuàng)建collectionView的時候注冊cell(一個分區(qū))
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@“cell" forIndexPath:indexPath];
for(UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
// ?2皱埠、在cellForItem方法中注冊cell(多個分區(qū))
NSString *identifier=[NSString stringWithFormat:@"%ld%ld",(long)indexPath.section,(long)indexPath.row];
[collect registerClass:[UICollectionViewCellclass] forCellWithReuseIdentifier:identifier];
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
for(id subView in cell.contentView.subviews){
? ? ? ? if(subView){
? ? ? ? ? [subView removeFromSuperview];
? ? ? ? ? }
}