我的图像视图中有一些图像,滚动视图中有图像名称,现在我想在单击图像时删除图像和相关名称......只需单击图像,图像名称应该被删除,图像也会被删除。
我的代码在这里......
-(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..