简体   繁体   English

带有延迟的 UIView 动画会阻止 UI 交互?

[英]UIView animate with delay blocks UI interactions?

The documentation for UIView animateWithDuration says that during the animation all user interactions are blocked. UIView animateWithDuration 的文档说在动画期间所有用户交互都被阻止。 But I'm wondering if it also blocks during the pre-animation delay.但我想知道它是否也会在预动画延迟期间阻塞。

The documentation says 文档

"During an animation, user interactions are temporarily disabled for the views being animated. (Prior to iOS 5, user interactions are disabled for the entire application.) If you want users to be able to interact with the views, include the UIViewAnimationOptionAllowUserInteraction constant in the options parameter." “在动画期间,正在动画的视图的用户交互被暂时禁用。(在 iOS 5 之前,整个应用程序的用户交互被禁用。)如果您希望用户能够与视图交互,请将 UIViewAnimationOptionAllowUserInteraction 常量包含在选项参数。”

But when I give a significant delay (let's say 1 second), it blocks the UI during that second as well.但是当我给出明显的延迟(假设是 1 秒)时,它也会在那一秒内阻止 UI。 I wouldn't guess that to be the case as the documentation for the delay parameter says:我不认为是这种情况,因为延迟参数的文档说:

"The amount of time (measured in seconds) to wait before beginning the animations. Specify a value of 0 to begin the animations immediately." “在开始动画之前等待的时间(以秒为单位)。指定值 0 以立即开始动画。”

Key words there are before beginning the animations while the note about blocking user interaction talks about during an animation .关键词有前开始的动画,而约在动画中阻止关于用户交互的会谈笔记。

However, my application doesn't update the UI during the pre-animation delay.但是,我的应用程序在预动画延迟期间不会更新 UI。 Does the delay block UI interactions as well or is my UI blocked for another reason?延迟是否也会阻止 UI 交互,或者我的 UI 是否因其他原因被阻止?

I can confirm that the UI is blocked during the delay before animation begins.我可以确认在动画开始之前的延迟期间 UI 被阻塞。 To be honest, I was surprised.老实说,我很惊讶。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM