uiviewanimation – UIView动画选项使用Swift

前端之家收集整理的这篇文章主要介绍了uiviewanimation – UIView动画选项使用Swift前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在UIView动画块中将UIViewAnimationOptions设置为.Repeat:
UIView.animateWithDuration(0.2,delay:0.2,options: UIViewAnimationOptions,animations: (() -> Void),completion: (Bool) -> Void)?)
Swift 3

几乎和以前一样:

UIView.animate(withDuration: 0.2,delay: 0.2,options: UIViewAnimationOptions.repeat,animations: {},completion: nil)

除了你可以省掉完整的类型:

UIView.animate(withDuration: 0.2,options: .repeat,completion: nil)

您仍然可以合并选项:

UIView.animate(withDuration: 0.2,options: [.repeat,.curveEaseInOut],completion: nil)

Swift 2

UIView.animateWithDuration(0.2,options: UIViewAnimationOptions.Repeat,completion: nil)

UIView.animateWithDuration(0.2,options: .Repeat,options: [.Repeat,.CurveEaseInOut],completion: nil)
原文链接:https://www.f2er.com/swift/320955.html

猜你在找的Swift相关文章