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

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

问题描述

我有一个UIScrollView在这里,我添加显示标签在屏幕的中间,当用户滚动到一个页面,问题是,当动画正在进行时,用户不能滚动到下一页



这是我显示标签的代码。

  if(!scrollView.dragging)
[UIView animateWithDuration:0.3
delay:0.3
options:UIViewAnimationOptionCurveEaseOut
animations:^ void){
[vesselNameLabel setFrame:frame];
}
completion:^(BOOL finished){}];那么我如何从scrollview上取消这个取消用户交互呢?

$ b


$ b

解决方案

好的,所以我想出了这一点。



原来的UIView的块动画默认块用户交互,要解决它需要传递UIViewAnimationOptionAllowUserInteraction作为选项之一。希望其他人也会使用这些信息。


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.

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

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