jeudi 7 juillet 2016

UIButton can't be touched while animated with UIView animateWithDuration


I have the following code:

[UIView animateWithDuration:0.3
                      delay:0.0
                    options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
                 animations:^{
                     CGRect r = [btn frame];
                     r.origin.y -= 40;
                     [btn setFrame: r];
                 }
                 completion:^(BOOL done){
                     if(done){
                         [UIView animateWithDuration:0.3
                                               delay:1
                                             options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction
                                          animations:^{
                                              CGRect r = [btn frame];
                                              r.origin.y += 40;
                                              [btn setFrame: r];
                                          }
                                          completion:^(BOOL done){if(done) zombiePopping = 0; }];
                     }

                 }];

The problem is, it seems the button doesnt respond to touches while being animated even though i'm using UIViewAnimationOptionAllowInteraction, which is a bit weird to me.

Maybe this most be done with Core Animation to work? and if so, how would i go about that?


Aucun commentaire:

Enregistrer un commentaire