// // RepairAddPicCollectionViewCell.m // patrol // // Created by Javen on 2016/10/23. // Copyright © 2016年 上海勾芒科技有限公司. All rights reserved. // #import "RepairAddPicCollectionViewCell.h" #import "ZJBaseFileModel.h" @implementation RepairAddPicCollectionViewCell - (void)awakeFromNib { self.layer.borderColor = [UIColor colorWithWhite:0.902 alpha:1.000].CGColor; self.layer.borderWidth = 1; UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(actionDelete)]; [self addGestureRecognizer:longPress]; } - (void)configCellWithArr:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath { if (indexPath.row == array.count) { //说明是添加按钮 self.img.hidden = NO; self.imgPicture.hidden = YES; self.index = 999; } else { self.img.hidden = YES; self.imgPicture.hidden = NO; id imageUrl = array[indexPath.row]; if ([imageUrl isKindOfClass:[NSString class]]) { if ([imageUrl hasPrefix:@"http://"]) { [self.imgPicture setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"AttachPhoto"]]; } else { self.imgPicture.image = [UIImage imageNamed:imageUrl]; } } else if ([imageUrl isKindOfClass:[UIImage class]]) { self.imgPicture.image = imageUrl; } else if([imageUrl isKindOfClass:[ZJBaseFileModel class]]){ [(ZJBaseFileModel *)imageUrl setImageView:self.imgPicture]; }else if ([imageUrl isKindOfClass:[UIImage class]]){ self.imgPicture.image = imageUrl; } self.index = indexPath.row; } } - (void)actionDelete { self.blockDelete(self.index); } @end