Why is -animateWithDuration:delay:options:animations:completion: blocking the UI?

后端 未结 2 649
醉酒成梦
醉酒成梦 2021-01-18 03:36

I always thought that Core Animation performs animations on the background. When I run this code, my UI interactions are blocked until the animation finishes:



        
2条回答
  •  孤街浪徒
    2021-01-18 03:44

    Looking at the documentation for UIView, I found this in the discussion section for that method:

    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.

    So, if you want user interaction to continue to be allowed, you must set this constant in the options parameter.

提交回复
热议问题