app starts ignores user interaction events when i call animateWithDuration:delay:options:animations:completion:

元气小坏坏 提交于 2019-12-12 02:48:16

问题


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];
                         }

                     }];

}

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?

Thanks


回答1:


According to the UIView Docs:

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.

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



来源:https://stackoverflow.com/questions/8433483/app-starts-ignores-user-interaction-events-when-i-call-animatewithdurationdelay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!