开发者

UIView animations canceling any touch input?

开发者 https://www.devze.com 2023-03-04 04:14 出处:网络
I have a UIScrollView here where I\'m adding displaying a label in the middle of the screen when the user has scrolled to a page, the problem is that while the animation is going the user can\'t scrol

I have a UIScrollView here where I'm adding displaying a label in the middle of the screen when the user has scrolled to a page, the problem is that while the animation is going the user can't scroll to the next page (all user interaction seem to be disabled) until the animation is over.

Here's my code for displaying the label.

if(!scrollView.dragging)
    [UIView animateWithDuration:0.3
                          delay:0.3
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^(void){
                         [vesselNameLabel setFrame:frame];
                     }
                     completion:^(BOOL finished){}];
开发者_开发技巧

So how would I get out of this canceling user interaction on the scrollview?


Okay, so I figured this out.

Turns out UIView's block animation by default blocks user interaction, and to get around it you need to pass UIViewAnimationOptionAllowUserInteraction as one of the options. Hopefully someone else will have some use of this information as well.


we noted a strange behaviour if alpha becomes 0 ... touches are ignored.

0

精彩评论

暂无评论...
验证码 换一张
取 消