UIView animations canceling any touch input?

2019-01-09 08:55发布

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?

2条回答
啃猪蹄的小仙女
2楼-- · 2019-01-09 09:31

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.

查看更多
姐就是有狂的资本
3楼-- · 2019-01-09 09:37

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

查看更多
登录 后发表回答