简体   繁体   English

UIView.animate不会延迟显示视图

[英]UIView.animate doesn't display view with delay

I have an AnimationHelper class with this method: 我有一个带有此方法的AnimationHelper类:

func display(view: UIView, withDelay: TimeInterval) {

  UIView.animate(withDuration: 0.2, delay: withDelay, options: .curveEaseIn, animations: {
    view.isHidden = false
  }, completion: nil)
}

And call this method from the another class: 并从另一个类调用此方法:

animationHelper.display(view: labelContainerView, withDelay: 1) 

and labelContainerView should display with a delay but appears immediately. labelContainerView应该延迟显示,但立即显示。

How can I display it with a delay? 如何延迟显示?

isHidden is not an animatable property. isHidden不是可设置动画的属性。 You can set alpha to 1.0 to make it appear with animation: 您可以将alpha设置为1.0,使其与动画一起显示:

view.alpha = 1.0

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

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