2012-03-02 63 views
0
CABasicAnimation *theAnimation; 
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; 
theAnimation.duration=0.5; 
theAnimation.repeatCount=0; 
theAnimation.autoreverses=NO; 
theAnimation.fromValue=[NSNumber numberWithFloat:100]; 
theAnimation.toValue=[NSNumber numberWithFloat:0]; 
//[self.quntityView animationDidStart:theAnimation]; 
[self.quntityView addAnimation:theAnimation forKey:@"animateLayer"]; 

回答

0

addAnimation:forKey:是CALayer上的方法。你不能只在UIView上調用它。

嘗試:

[self.quntityView.layer addAnimation:theAnimation forKey:@"animateLayer"]; 
+0

[self.quntityView.layer addAnimation:theAnimation forKey:@ 「animateLayer」];使用這一行視圖的動畫是正確的,它太慢。如何加速視圖,而它的出現.. – 2012-03-02 12:47:17

+0

我很困惑你的意思。你問了半秒的時間 - 動畫是否需要半秒以上? – 2012-03-02 15:31:10

相關問題