So i have a UIImageView and an NSMutuableArray of four UIImages.
I just made this UIImageView animated, all the four images are animating in this imageview in a series perfectly as it should be.
Now what i want is: When user tapped on ImageView,
Which Image is just tapped by USER.
UIImageView User Intraction is enabled
UIGestureRecognizerDelegate is Added
-(void)viewDidAppear:(BOOL)animated
{
UITapGestureRecognizer *tapGesture =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTaps:)];
tapGesture.numberOfTapsRequired = 1;
[myImageView addGestureRecognizer:tapGesture];
[self performSelectorInBackground:@selector(showAnimatedImages) withObject:nil];
[super viewDidAppear:animated];
}
- (void) showAnimatedImages
{
myImageView.animationImages = imagesArray;
myImageView.animationDuration = 12.0f;
[myImageView startAnimating];
}
- (void)handleTaps:(UITapGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateRecognized)
{
UIImage *selectedImage = [myImageView image]; // return nil
//OR
UIImage *selectedImage = myImageView.image; // return nil
//OR
NSData *imgData = UIImagePNGRepresentation(myImageView.image); // return nil
}
}
as you see myImageView.image is always giving me a nil Value.
so please tell me how can i get image from this animating imageview.