接收器类型'UIView'实例消息未声明具有选择器'addAnimation:forKey:'的方法

时间:2012-03-02 11:36:17

标签: objective-c

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"];

1 个答案:

答案 0 :(得分:0)

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

尝试:

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