0
我目前正在一個項目,我有一個滾動視圖和四個不同的屏幕。我使用了一個簡單的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()
你的代碼看起來好嗎,你把這個代碼放在哪裏? –
你爲什麼要設置圖像呢? –