我目前正在开展一个项目,我有一个滚动视图和四个不同的屏幕。我使用了一个简单的UIImage(名为:“”)!,代码将图像帧放入我的imageView并为图像设置动画。
我遇到问题,当我滑动到下一个屏幕时,动画已经完成。我不知道如何制作它,以便当我滑动到下一个屏幕时,动画将开始。
以下是动物动画的代码
imageView.animationDuration = 1
imageView.animationRepeatCount = 1
imageView.animationImages =
[
UIImage(named:"Deer_00014")!,
UIImage(named:"Deer_00015")!,
UIImage(named:"Deer_00016")!,
UIImage(named:"Deer_00017")!,
UIImage(named:"Deer_00018")!,
UIImage(named:"Deer_00019")!,
UIImage(named:"Deer_00020")!,
UIImage(named:"Deer_00021")!,
UIImage(named:"Deer_00022")!,
UIImage(named:"Deer_00023")!,
UIImage(named:"Deer_00024")!,
UIImage(named:"Deer_00025")!,
UIImage(named:"Deer_00026")!,
UIImage(named:"Deer_00027")!,
UIImage(named:"Deer_00028")!,
UIImage(named:"Deer_00029")!,
UIImage(named:"Deer_00030")!,
UIImage(named:"Deer_00031")!,
UIImage(named:"Deer_00032")!,
UIImage(named:"Deer_00033")!,
UIImage(named:"Deer_00034")!,
UIImage(named:"Deer_00035")!,
]
self.imageView.image = UIImage(named: "Deer_00035")
imageView.startAnimating()
答案 0 :(得分:0)
只需删除此行
即可self.imageView.image = UIImage(named: "Deer_00035")
基本上你在这里将图像设置为ímageview'覆盖动画。