UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(1.0)
self.floatView.alpha = 0.0
UIView.commitAnimations()
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(1.0)
self.floatView.alpha = 1.0
UIView.commitAnimations()
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(2.0)
imgV.center = CGPoint(x:250,y:250)
UIView.commitAnimations()
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(2.0)
imgV.frame = CGRect(x:100,y:180,width:50,height:50)
UIView.commitAnimations()
UIView.animate(withDuration: 0.3) {
} completion: { _ in
}
UIViewAnimationTransition定义了 5 种过渡动画类型:
none:无过渡动画效果
flipFromLeft:从左侧向右侧翻转
flipFromRight:从右侧向左侧翻转
curlUp:向上卷数翻页
curlDown:向下翻页
UIView.beginAnimations("animation", context: nil)
UIView.setAnimationDuration(2.0)
UIView.setAnimationCurve(.easeInOut)
UIView.setAnimationTransition(.flipFromLeft, for: self.view2!, cache: false)
self.view.exchangeSubview(at: 1, withSubviewAt: 0)
UIView.commitAnimations()