Syn*_*hro 2 uiviewanimation ios
我正在尝试UIImageView
动画时检测到触摸.触摸检测在动画开始之前工作,一旦停止,但不会在期间停止.
我试过添加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){}];
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议!
归档时间: |
|
查看次数: |
5943 次 |
最近记录: |