禁用UICollectionViewCell或者自定义collectionViewCel的复用
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
禁用UICollectionReusableView或者自定义的collectionReusableView的组尾复用
for (UIView *view in footReusableView.subviews) {
// 如果view为UIImageView类型的或者是ZBButton类型的,就将满足条件的view从UICollectionReusableView或者自定义的collectionReusableView上移除
if ([view isKindOfClass:[UIImageView class]] || [view isKindOfClass:[ZBButton class]]) {
[view removeFromSuperview];
}
}
------------------------------------具体代码------------------------------------
禁用collectionViewCell内容复用
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
AS_ZBEvaluateCell *JobIntensionCollectionViewCell = [collectionView dequeueReusableCellWithReuseIdentifier:EvaluateCelID forIndexPath:indexPath];
// 禁用collectionViewCell
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
AS_ZBEvaluateModel *model = self.evaluateArray[indexPath.row];
[JobIntensionCollectionViewCell relayoutUIWithThirdListModel:model];
return JobIntensionCollectionViewCell;
}
禁用collectionReusableView组尾复用
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
if (kind == UICollectionElementKindSectionFooter) {// 为collectionView添加尾部内容
AS_ZBEvaluateBottomReusableView *footReusableView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:BottomReusableViewID forIndexPath:indexPath];
禁用collectionReusableView组尾复用
for (UIView *view in footReusableView.subviews) {
/ 如果view为UIImageView类型的或者是ZBButton类型的,就将满足条件的view从UICollectionReusableView或者自定义的collectionReusableView上移除
if ([view isKindOfClass:[UIImageView class]] || [view isKindOfClass:[ZBButton class]]) {
[view removeFromSuperview];
}
}
[footReusableView imageArray:self.cameraList cameraList:self.btnCameraList imageBorderArray:self.imgBorderArray cameraCloseList:self.cameraCloseListArray];
@weakify(self);
footReusableView.photo = ^{
@strongify(self);
[self showPhoto];
};
footReusableView.workContent = ^(NSString *content) {
self.workContentStr = content;
};
return footReusableView;
}else{
return nil;
}
}
嘿嘿嘿