首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何声明CAKeyframeAnimation?

如何声明CAKeyframeAnimation?
EN

Stack Overflow用户
提问于 2011-05-25 18:43:35
回答 1查看 1.1K关注 0票数 1

我正在尝试沿着预定义的路径移动图像。我使用了下面的代码。但它说的是这样的:

代码语言:javascript
复制
CAKeyframeAnimation undeclared
kCAAnimationPaced undeclared 

我是iPhone开发的新手,请帮助我。

代码语言:javascript
复制
*pathAnimation = [CAKeyframeAnimationanimationWithKeyPath:@"position"];
pathAnimation.duration = 1.0f;
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;

CGMutablePathRef pointPath = CGPathCreateMutable();
CGPathMoveToPoint(pointPath, NULL, 492, 128);
CGPathAddLineToPoint(pointPath, NULL, 480, 150);
CGPathAddLineToPoint(pointPath, NULL, 489, 160);
CGPathAddLineToPoint(pointPath, NULL, 489, 180);
pathAnimation.path = pointPath;
CGPathRelease(pointPath);

[imageview.layer addAnimation:pathAnimation forKey:@"pathAnimation"];
EN

回答 1

Stack Overflow用户

发布于 2011-05-25 19:39:48

您一定没有导入框架。导入它(有关帮助,请参见this )并将#import <QuartzCore/QuartzCore.h>添加到*.pch文件中。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6123191

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档