Having problems allowing interaction in UIView animation

前端 未结 5 472
野趣味
野趣味 2021-01-03 12:23

I have the following block of code to fade out an introView(UIView)

// Hide intro view after 5 seconds
[UIView animateWithDuration: 1.0
          delay: 5.0
         


        
5条回答
  •  遥遥无期
    2021-01-03 13:07

    I found another circumstance which could cause this. I haven't seen this answer anywhere else. It does not deal with alpha at all.

    If you use a delay in the call to UIView.animate(), then even if you specify the .allowUserInteraction option, the view does NOT receive touches during the delay period. I have no idea why, but I could help it by moving the code block to another function, and using a performSelector after the same delay seconds, and in the block I run the code without delay.

提交回复
热议问题