I'm trying to detect a touch whilst my UIImageView
is animating.
The touch detection works before the animation starts, and once it
stops, but not during.
I've tried adding UIViewAnimationOptionAllowUserInteraction
, but it
seems to have no effect at all!
Could anyone point me in the right direction?
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
NSLog(@"tag=%@", [NSString stringWithFormat:@"%i", touch]);
if ([touch view] == itemCoke)
{
NSLog(@"Coke Touched");
}
}
- (IBAction)removeItemButton:(id)sender {
NSLog(@"Pushed");
[UIView animateWithDuration:5
delay:0.0
options:UIViewAnimationOptionAllowUserInteraction
animations:^
{
itemCoke.transform = CGAffineTransformRotate(itemCoke.transform, (M_PI*-0.5));
itemCoke.frame = CGRectMake(50, 50, 50, 50);
}
completion:^(BOOL finished){}];
}
Thanks for any advice!