这是我的代码,并且跳过按钮动画不起作用。它只是立即消失。
它就消失了
skipButtonBottomConstraint.constant = -40
UIView.animate(withDuration: 1.0, animations: {
self.titleLabel.alpha = 0
self.skipButton.alpha = 0
self.pageControl.alpha = 0
self.view.setNeedsLayout()
})
你能解释一下原因吗?
最佳答案
我认为Paul是对的,您应该在动画块中调用layoutIfNeeded()
,而不是setNeedsLayout()