如何区分单个UICollectionViewCell
处理。我根据indexPath
行处理它将是一个问题。
答案 0 :(得分:0)
UICollection视图有一个类似于tableView的委托方法
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
cell.layer.borderWidth = 1;
cell.layer.borderColor = [[UIColor whiteColor]CGColor];
UIImageView *image = [[UIImageView alloc]init];
image.image = [UIImage imageWithData:[self.imagesGallery objectAtIndex:indexPath.row]];
image.frame = CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height);
[cell addSubview:image];
return cell;
}