我试过这个
控制器中的
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.gifView disAppearReload];
}
- (void)disAppearReload {
self.withoutImg = YES;
[self.collectionView reloadData];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
WaterfallCell *cell = [WaterfallCell cellWithCollentionView:collectionView IndexPath:indexPath];
cell.delegate = self;
cell.withoutImg = self.isWithoutImg;
cell.cellModel = self.cellModels[indexPath.row];
return cell;
}
- (void)setCellModel:(ImageModel *)cellModel {
_cellModel = cellModel;
if (self.isWithoutImg) {
self.imageBtn.imageView.image = nil;
}
else {
[self.imageBtn sd_setImageWithURL:[NSURL URLWithString:cellModel.imgUrl] forState:UIControlStateNormal placeholderImage:nil options:SDWebImageLowPriority];
}
}
它不起作用,不能调用单元代码,但UITableView中的方法相同。帮助~~~
答案 0 :(得分:0)
使用viewWillappear来调用collectionview的委托和 你可以做的是使用viewDidDisAppear并在那里做你的委托null。