动画时UIButton没有响应
问题描述:
出于某种原因,我的UIButton在动画时不会响应UIControlEvents。这里是我的动画:动画时UIButton没有响应
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:[duration intValue]];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
// change parent UIView's frame
[UIView commitAnimations];
当它到达最后,它会让我点击它......但不是当它动画时。顺便说一下,我正在使用UIControlEventTouchUpInside。
谢谢。
答
应设置UIViewAnimationOptionAllowUserInteraction
动画选项
更容易块动画完成:
[UIView animateWithDuration:[duration intValue] options:UIViewAnimationOptionAllowUserInteraction animations^{
//set parent UIView's frame
}];
Hmmmm ...仍然没有工作。任何其他想法? – iosfreak 2012-08-05 22:07:04
根据[这个问题](http://*.com/questions/8346100/uibutton-cant-be-touched-while-animated-with-uiview-animatewithduration)按钮的可触摸框架并不总是与可见框架,所以你可能需要做一些自定义的触摸处理 – wattson12 2012-08-05 22:22:35
+1,谢谢它帮助我的ios 4.因为ios 5&6不需要这种方法:) – mAc 2012-10-10 10:14:32