iosfreak iosfreak - 6 months ago 15
Objective-C Question

UIButton not responding when animating

For some reason my UIButton won't respond to UIControlEvents while animating. Here's how I animate:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:[duration intValue]];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
// change parent UIView's frame
[UIView commitAnimations];

When it reaches the end, it will let me tap it... but not while it's animating. I am using UIControlEventTouchUpInside, by the way.



You should set the UIViewAnimationOptionAllowUserInteraction animation option

easier done with block animations:

[UIView animateWithDuration:[duration intValue] options:UIViewAnimationOptionAllowUserInteraction animations^{
    //set parent UIView's frame