2016-03-11 85 views
-1

我想將速度設置爲我的UISlider,以使其移動更平穩。如何將相同的速度設置爲UIView動畫

這裏是我正在試圖製作動畫:

UIView.animateWithDuration(6, delay: 0.0, options: UIViewAnimationOptions.TransitionCurlUp, animations: {() -> Void in 

      self.videoSlider.setValue(time, animated: true) 
      if self.videoSlider.value == self.videoSlider.maximumValue { 
       self.playerLayer.stop() 
       self.playBigButton.hidden = false 
       self.pauseButton.hidden = true 
       self.playButton.hidden = false 
      } 

      }, completion: { (finished: Bool) -> Void in 

     }) 

但它以不同的速度運動的開始,中間和結尾。

+1

爲什麼你使用'UIViewAnimationOptions.TransitionCurlUp'? – dokun1

+0

什麼是'videoSlider'? – matt

+0

@ dokun1抱歉只是測試了一些東西 –

回答

0

先給動畫的.CurveLinear的選項,如:

UIView.animateWithDuration(6, 
         delay: 0.0, 
        options: [UIViewAnimationOptions.TransitionCurlUp, .CurveLinear], 
        animations: {() -> Void in 

      self.videoSlider.setValue(time, animated: true) 
      if self.videoSlider.value == self.videoSlider.maximumValue { 
       self.playerLayer.stop() 
       self.playBigButton.hidden = false 
       self.pauseButton.hidden = true 
       self.playButton.hidden = false 
      } 

      }, completion: { (finished: Bool) -> Void in 

     }) 
相關問題