您的位置:首页 > 其它

userInteractionEnabled属性理解

2015-02-27 16:11 288 查看
A Boolean value that determines whether user events are ignored and removed from the event queue.

一个布尔值,它决定了是否用户触发的事件被该视图对象忽略和把该视图对象从事件响应队列中移除。

UIView userInteractionEnabled 默认值是YES

一些UIKit的子类(UIImageView,UILabel,UIButton...)重写了这个属性
导致返回不同的默认值 默认值是NO

During an animation, user interactions are temporarily disabled for all views involved in the animation, regardless of the value in this property. You can disable this behavior by specifying the UIViewAnimationOptionAllowUserInteraction option when configuring
the animation.

在播放动画的时候,不论userInteractionEnabled的值是YES还是NO,用户交互会被临时设置为不支持交互的状态。

如果在播放动画的时候,你想让对象依然保持可交互状态,那么你需要设置动画的UIViewAnimationOptions的属性值为UIViewAnimationOptionAllowUserInteraction。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: