gpt4 book ai didi

ios - Swift - 连续背景动画循环

转载 作者:搜寻专家 更新时间:2023-11-01 06:23:37 25 4
gpt4 key购买 nike

有人能告诉我如何制作 UIimageviews alpha 属性的无限循环动画吗?从 0 - 1、1 - 0。我对 iOS 和一般编程还很陌生,所以这听起来可能很愚蠢。如果不将整个应用程序置于无限循环中,我将如何完成此操作。

最佳答案

连续动画我不认为这在移动应用程序中是一个好的做法,也许我自己错了。不管怎样,你可以尝试下面的方法

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.customView.backgroundColor = UIColor(red: 0.0, green: 255.0 , blue: 255.0, alpha: 1.0)
dispatch_async(dispatch_get_main_queue(), {
self.performAnimation()

})

}

func performAnimation() {

UIView.animateWithDuration(2.0, delay: 0.5, options: .CurveEaseOut | .Repeat | .Autoreverse, animations: {
self.customView.alpha = 0.0
}, completion: nil)

}

其中 customView 是我的 UIView,您可以类似地创建您的 UIImageView。

关于ios - Swift - 连续背景动画循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28644335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com