0

我的 iPad 应用程序有一个自定义用户界面,并且同时拖动了一个对象和按钮事件。我的问题是,当我拖动对象时,动画开始工作,而当我离开对象时,动画仍然工作了一段时间。同时,当我尝试按下按钮或拖动另一个对象时,它在动画完成之前无法工作。

4

1 回答 1

0

如果您想与UIButton动画交互:
使用(核心)动画;您不能在动画周期中与元素交互(常规方式)。只有当动画完成后,您才能再次与他们互动。您可以在主视图上创建自己的触摸处理程序,以检查触摸是否“靠近”动画按钮。

如果您想与“休息”交互:
确保使用UIViewAnimationOptionAllowUserInteraction参数为对象设置动画:

During an animation, user interactions are temporarily disabled for the views being animated. (Prior to iOS 5, user interactions are disabled for the entire application.) If you want users to be able to interact with the views, include the UIViewAnimationOptionAllowUserInteraction constant in the options parameter.

于 2012-07-27T07:29:08.480 回答