iosfreak iosfreak - 1 year ago 80
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.


Answer Source

You should set the UIViewAnimationOptionAllowUserInteraction animation option

easier done with block animations:

[UIView animateWithDuration:[duration intValue] options:UIViewAnimationOptionAllowUserInteraction animations^{
    //set parent UIView's frame
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download