0

I have created an animation. This animation is a button. But when I touch this button, nothing appears.

I have activated the option :

UIViewAnimationOptionAllowUserInteraction

This is my animation's code :

[UIView animateWithDuration:1.5
                            delay:0
                            options:(UIViewAnimationOptionAllowUserInteraction)
        animations:^{
            btnRock.center = CGPointMake(btnRock.center.x - 450, btnRock.center.y - positionY);
        }completion:^(BOOL finished){
                btnRock.center = CGPointMake(btnRock.center.x + 450, btnRock.center.y + positionY+ positionYBase);
            [self play];
        }];

And this is my button's code :

-(IBAction)touchRock:(id)sender{
    cptScore++;
    score.text = [[NSString alloc] initWithFormat: @"%.d", cptScore];
}
  • Delay the button animation by five seconds. See if you can touch the button before the animation starts. – 67cherries May 22 '14 at 22:00
  • I can't, but when I remove my code with the animation, my function "touchRock" works – user3657063 May 22 '14 at 22:08
  • Related: http://stackoverflow.com/questions/8346100/uibutton-cant-be-touched-while-animated-with-uiview-animatewithduration/8346178#8346178 – augustzf May 22 '14 at 22:08
  • I try that, but I have an error with : "buttonsOutletCollection" The error is : Property "buttonsOutletCollection" not found on object of type "ViewController *" – user3657063 May 22 '14 at 22:31

0 Answers0