Iphone 在触摸屏上删除图像视图

Iphone 在触摸屏上删除图像视图,iphone,ios,Iphone,Ios,我有一些图片在我的图片视图和图片名称在我的滚动视图,现在我想删除图片和相关的名称点击图片。。。。。。只需点击图片,图片名称就会被删除,图片也会被删除 我的代码在这里 -(void)imageViewTapped:(UITapGestureRecognizer*)sender { bool isFound = FALSE; NSInteger foundIndex=0; NSInteger index = sender.view.tag; NSMutableDict

我有一些图片在我的图片视图和图片名称在我的滚动视图,现在我想删除图片和相关的名称点击图片。。。。。。只需点击图片,图片名称就会被删除,图片也会被删除

我的代码在这里

-(void)imageViewTapped:(UITapGestureRecognizer*)sender
{
    bool isFound = FALSE;
    NSInteger foundIndex=0;
    NSInteger index = sender.view.tag;
    NSMutableDictionary *currentObject = [dataArray objectAtIndex:index];
    NSLog(@"id 1: %@", [currentObject objectForKey:@"_ID"]);
    for (NSMutableDictionary *object in nameDAtaArray)
    {
    NSInteger currentId = [[object objectForKey:@"_ID"] intValue];
        NSLog(@"id 2: %d", currentId);
        if([[currentObject objectForKey:@"_ID"] intValue] == currentId)
        {
            ++point;

            isFound = TRUE;
            NSLog(@"view tag...%d",sender.view.tag);
            [sender.view removeFromSuperview];

            };
            break;
        }
        foundIndex++;
    }
    if(!isFound)
    {

        point--;
    }
    else
    {
        [nameDAtaArray removeObjectAtIndex:foundIndex];
        [self showNameLabelInScrollView];
        [nameContainerScrollView setNeedsDisplay];
    }
    [self showpointlabel];
}

thanks in advance..

如果仅隐藏,则仅设置Alpha。比如,imageview.alpha=0

请格式化您的代码,解释当前发生的情况以及您希望它如何以不同方式工作。
-(void)scrollViewsingleTappedInScrollMethod:(UITapGestureRecognizer *)recognizer{

       imageview = (UIImageView *)recognizer.view;

      //we select the image using tag.(contain many images)
    if ([imageview tag] == 100) {

         NSFileManager *fileManager = [NSFileManager defaultManager];
   NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,   YES);
   NSString *documentsDirectory = [paths objectAtIndex:0];
   NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:
                      [NSString stringWithFormat:@"%@.png", fileName]];

   NSError *error = nil;
   if(![fileManager removeItemAtPath: fullPath error:&error]) {
      NSLog(@"Delete failed:%@", error);
   } else {
      NSLog(@"image removed: %@", fullPath);
   }

   NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];    
   NSLog(@"Directory Contents:\n%@", [fileManager directoryContentsAtPath: appFolderPath]);


        }

        }