例如接收者类型'UIView'消息没有声明带有选择器'addAnimation:forKey:'的方法
问题描述:
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"];
答
addAnimation:forKey:
是CALayer上的方法。你不能只在UIView上调用它。
尝试:
[self.quntityView.layer addAnimation:theAnimation forKey:@"animateLayer"];
[self.quntityView.layer addAnimation:theAnimation forKey:@ “animateLayer”];使用这一行视图的动画是正确的,它太慢。如何加速视图,而它的出现.. – 2012-03-02 12:47:17
我很困惑你的意思。你问了半秒的时间 - 动画是否需要半秒以上? – 2012-03-02 15:31:10