简体   繁体   中英

UIView.animate doesn't display view with delay

I have an AnimationHelper class with this method:

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.

How can I display it with a delay?

isHidden is not an animatable property. You can set alpha to 1.0 to make it appear with animation:

view.alpha = 1.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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