こんにちはすべて私はこの中で助けてください: このUICollectionView
の私はUICollectionView
を取ったので、私は画像を追加しています、私はボタンのクリックで特定の画像を削除したい。 削除したい画像に閉じるボタンがあります。 このタスクはどのように実行できますか。 注: 1)手伝っていただく前に一度画像をご覧ください。 2)画像を追加するために行ったコードをご覧ください。特定のUICollectionViewCellイメージを削除する方法。特定の画像のボタンを押すと
イメージ: My Image
//**** For image work ****
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *ident = @"Cell";
OwnerPropertyCollectionViewCell *cell = (OwnerPropertyCollectionViewCell*)[collectionView dequeueReusableCellWithReuseIdentifier:ident forIndexPath:indexPath];
imgView = (UIImageView*)[cell viewWithTag:100];
if (indexPath.row ==0) {
cell.Imgprofile_pic.image = [UIImage imageNamed:[imgArray objectAtIndex:indexPath.row]];
cell.btnImageCancel.image = [UIImage imageNamed:@"add"];
UITapGestureRecognizer *reconizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addphoto:)];
[cell addGestureRecognizer:reconizer];
}
else {
// get image not name
cell.Imgprofile_pic.image = [imgArray objectAtIndex:indexPath.row];
cell.btnImageCancel.image = [UIImage imageNamed:@"close"];
}
return cell;
}
// To add image:
-(void)addphoto:(UITapGestureRecognizer*)reconizer
{
imageHelper = [UIImagePickerHelper new];
[imageHelper imagePickerInViewController:self WithSuccess:^(UIImage *image) {
imgView.image = image;
[imgArray addObject:image];
[self.collectionView reloadData];
} failure:^(NSError *error) {
}];
NSLog(@"Image added successfully");
}
// What to code for delete image:
- (IBAction)btnCancelButtonAction:(id)sender {
NSLog(@"Delete button pressed");
}
ママに感謝しますが、私はまだ混乱しています。私はそれに感謝の仕事をしています。 – raj