UIView 动画取消任何触摸输入? [英] UIView animations canceling any touch input?

查看:28
本文介绍了UIView 动画取消任何触摸输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有一个 UIScrollView,当用户滚动到一个页面时,我添加在屏幕中间显示一个标签,问题是当动画播放时用户无法滚动到下一页(所有用户交互似乎都被禁用)直到动画结束.

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?

推荐答案

好的,我想通了.

事实证明 UIView 的块动画默认会阻止用户交互,要绕过它,您需要将 UIViewAnimationOptionAllowUserInteraction 作为选项之一传递.希望其他人也能使用这些信息.

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.

这篇关于UIView 动画取消任何触摸输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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