你必须执行如下操作:-
UIView.animate(withDuration: 0.2, animations: {
//perform animation of height
}, completion: { _ in
UIView.animate(withDuration: 0.2, animations: {
//perform animation of width
}, completion: nil)
})
如果您想添加一些动画选项,请使用以下代码:--
UIView.animateWithDuration(0.2, delay: 0.2, options: UIViewAnimationOptions."Set your Animationoption", animations: {
//perform animation of height
}, completion: { _ in
UIView.animateWithDuration(0.2, delay: 0.2, options: UIViewAnimationOptions."Set your Animationoption", animations: {
//perform animation of width
}, completion: nil)
})
两者结合:-
UIView.animateWithDuration(0.2, delay: 0.2, options: UIViewAnimationOptions."Set your Animationoption", animations: {
//perform animation of width
}, completion: nil)
UIView.animateWithDuration(0.2, delay: 0.2, options: UIViewAnimationOptions."Set your Animationoption", animations: {
//perform animation of height
}, completion: nil)
谢谢。