Ios 按下按钮时停止动画

Ios 按下按钮时停止动画,ios,objective-c,iphone,animation,uibutton,Ios,Objective C,Iphone,Animation,Uibutton,我有下面的代码,这是一个UIButton的动画。但当按下按钮时,我希望动画立即停止并执行其他操作,而如果动画继续,则执行其他操作。我的问题是,即使我按下按钮,动画仍将继续,它将执行步骤1和2 我在代码中遗漏了什么 int frame1 = 600; int frame2 = 100; hit11 = [[UIButton alloc]initWithFrame:CGRectMake((arc4random() % (frame1 - frame2)+frame2),200,20,

我有下面的代码,这是一个UIButton的动画。但当按下按钮时,我希望动画立即停止并执行其他操作,而如果动画继续,则执行其他操作。我的问题是,即使我按下按钮,动画仍将继续,它将执行步骤1和2

我在代码中遗漏了什么

int frame1 = 600;
    int frame2 = 100;
    hit11 = [[UIButton alloc]initWithFrame:CGRectMake((arc4random() % (frame1 - frame2)+frame2),200,20,20)];
      [hit11 addTarget:self action:@selector(hit:) forControlEvents:UIControlEventTouchUpInside];
    [hit11 setBackgroundImage:[UIImage imageNamed:@"touchrightdown.png"] forState:UIControlStateNormal];
    [self.view addSubview:hit11];
    [UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationCurveEaseIn | UIViewAnimationOptionAllowUserInteraction animations:^{
        hit11.transform = CGAffineTransformMakeScale(7,7);
        hit11.alpha=0.5;
    } completion:^(BOOL finished) {
        if (finished) {
            //DO STEP 2.
hit11.hidden=YES;

        }



        NSLog(@"got hit");


    }];

-(void) hit:(UIButton*)sender{
    NSLog(@"1/10");
    //DO STEP 1.
}
尝试添加以下内容:

[sender.layer removeAllAnimations];
在hit:(UIButton*)发送方方法中