我試圖檢測觸摸,而我的UIImageView
正在進行動畫製作。 觸摸檢測在動畫開始之前工作,並且一旦它停止,但不在期間。UIViewAnimationOptionAllowUserInteraction不起作用
我試過添加UIViewAnimationOptionAllowUserInteraction
,但它 似乎根本沒有效果!
任何人都可以指向正確的方向嗎?
代碼:
-(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){}];
}
感謝您的諮詢!