第一个CAAnimation程序出错

时间:2013-02-11 01:08:11

标签: ios cocoa-touch caanimation

这就是所谓的:

-(IBAction)preform:(id)sender{
 CALayer *layer = [CALayer layer];
 [layer setPosition:CGPointMake(100.0, 100.0)];
 [layer setBounds:CGRectMake(0.0, 0.0, 50.0, 60.0)];
 [layer setBackgroundColor:[[UIColor redColor] CGColor]];
 [self.view.layer addSublayer:layer];

 CABasicAnimation *animation = [CABasicAnimation animation];
 [animation setFromValue:[NSValue valueWithCGPoint:CGPointMake(100.0, 100.0)]];
 animation.toValue = [NSValue valueWithCGPoint:CGPointMake(100.0, 250.0)];
 [layer addAnimation:animation forKey:@"position"];
}

这是错误: 我对IOS动画知之甚少,不知道如何解决这个问题

http://i.stack.imgur.com/IMu0F.png

1 个答案:

答案 0 :(得分:0)

你必须在你的项目中添加框架QuartzCore ..

这是如何... https://stackoverflow.com/a/6961788/1518182