UIView animateWithDuration:动画UIButton无法触及事件ios 8

时间:2015-09-01 05:52:46

标签: ios objective-c uibutton uiviewanimation

我在移动按钮时使用此代码,但在转换过程中禁用了该事件

在移动时我该怎么做? 这是我的代码......

    button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(210, 285, 120, 118);
    [button setTitle:@"" forState:(UIControlState)UIControlStateNormal];
    [button addTarget:self action:@selector(botonTap:) forControlEvents:(UIControlEvents)UIControlEventTouchDown];

    [button setBackgroundImage:[UIImage imageNamed:@"car.png"] forState:UIControlStateNormal];

    [self.view addSubview:button];

移动屏幕并禁用事件完成:(

[UIView animateWithDuration:10
                      delay:0.0f
                    options: UIViewAnimationOptionAllowUserInteraction |
 UIViewAnimationOptionLayoutSubviews | UIViewAnimationOptionCurveEaseIn
                 animations:^{

                     button.frame = CGRectMake(0, 4, 120, 118);

                 }
                 completion:^(BOOL finished){

                 }];

点按此按钮时,请不要输入此方法,只能在停止时使用:

-(IBAction)botonTap:(id)sender {
    button.alpha=0;
}

0 个答案:

没有答案