我有這段代碼可以旋轉我的imageview,但是當我按下我的暫停按鈕時我想旋轉速度爲0.我該怎麼做?如何將Swift中的旋轉速度降低爲0?
@IBAction func playButtonL(sender: AnyObject) {
rotation.toValue = NSNumber(double: M_PI * 2)
rotation.duration = 2
rotation.cumulative = true
rotation.repeatCount = FLT_MAX
self.leftCircleImageView.layer.addAnimation(rotation, forKey: "rotationAnimation")
}
@IBAction func pauseButtonR(sender: AnyObject) {
}
它的作品,但我有一個問題是,它停止時,它會回到原來的位置。我希望它停止在它的位置。 – coding22
接受答案,如果它適合你。 – amorbytes