使用UIView.animateWithDuration在Swift中放入一个简单的淡入淡出?

时间:2014-06-14 13:18:36

标签: ios animation uiview swift

我每隔一秒就会换一次图像。使用计时器更改它的代码应具有动画。第self.finalDotImageView.image = self.openingScreenDynamicDot 行是实际更改它的行。

所以,我这样做了,图像仍像以前一样进入:

如何制作动画?

func changeDot() {
    println("the images should be changing...")
    var theRandomImages: UIImage[] = [dotOne, dotTwo, dotThree, dotFour, dotFive, dotSix, dotSeven, dotEight, dotNine, dotTen, dotEleven, dotTwelve, dotThirteen]
    imageNumber = Int(arc4random_uniform(13))
    openingScreenDynamicDot = theRandomImages[Int(imageNumber)]
    UIView.animateWithDuration(1.0, animations: {
        self.finalDotImageView.image = self.openingScreenDynamicDot
      })
}

0 个答案:

没有答案