小编Syn*_*hro的帖子

UIViewAnimationOptionAllowUserInteraction不工作

我正在尝试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)

谢谢你的建议!

uiviewanimation ios

2
推荐指数
1
解决办法
5943
查看次数

标签 统计

ios ×1

uiviewanimation ×1