当我调用animateWithDuration时,app开始忽略用户交互事件:delay:options:animations:completion: [英] app starts ignores user interaction events when i call animateWithDuration:delay:options:animations:completion:

查看:344
本文介绍了当我调用animateWithDuration时,app开始忽略用户交互事件:delay:options:animations:completion:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序(UIButton的子类)中有一个按钮。要为发光设置动画我使用以下方法

I have a button that glows in my app (subclass of UIButton). To animate the glowing i use the following method

- (void)glow
{

    [UIView animateWithDuration:1.0f 
                          delay:0.0f 
                        options:UIViewAnimationOptionCurveEaseInOut 
                     animations:^(void){

                         if (glowingImageView_.alpha != 1.0f) {
                             [glowingImageView_ setAlpha:1.0f];
                         }
                         else {
                             [glowingImageView_ setAlpha:0.3f];
                         }

                     } 
                     completion:^(BOOL finnished){

                         if (on_) {
                             [self glow];
                         }

                     }];

}

在iOS 5上运行良好,但在iOS 4.3中运行良好我的应用停止处理任何用户交互。任何人都知道可能导致这种情况的原因是什么?

It works fine running on iOS 5, but in iOS 4.3 my app stops handling any user interaction. Any one have any idea what might be causing this?

谢谢

推荐答案

根据 UIView 文档:

在动画期间,对于正在设置动画的视图,会暂时禁用用户交互。 (在iOS 5之前,整个应用程序都禁用了用户交互。)如果您希望用户能够与视图进行交互,请包含 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.

因此在iOS 4.3中,禁用了用户交互。多数民众赞成你的问题。

So in iOS 4.3, user interactions were disabled. Thats your problem.

这篇关于当我调用animateWithDuration时,app开始忽略用户交互事件:delay:options:animations:completion:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆