I load a UIImageView
with an image depending on user interaction. When the parent view is initially displayed, no image has been selected and the imageview is blac
You can use a UITapGestureRecognizer
to remove the image for a given number of clicks.
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onImageTapped:)];
tapGesture.delegate = self;
tapGesture.numberOfTapsRequired = 2; // no. of taps (clicks) on which you want to remove the image
[myImageView addGestureRecognizer:tapGesture];
and give the method's definition:
- (void)onImageTapped:(UITapGestureRecognizer*)recognizer
{
UIImageView *imgView = (UIImageView*) recognizer.view;
[imgView removeFromSuperview];
}