2009-07-21 32 views
2

出于某种原因,Xcode告诉我,只要我使用类似kCAFillModeForwards的东西,它就不会找到符号。必须有一个图书馆或班级,我必须包括......但哪一个?正常的核心动画的东西很好,像[myView beginAnimations ...]。让更复杂的动画工作起作用有什么窍门?为什么我不能做任何CABasicAnimation或关键帧动画?

我已经包括在.h文件:

#import <UIKit/UIKit.h> 
#import <QuartzCore/QuartzCore.h> 

@interface TestClass : UIView { 

} 
// ... 

我运行此代码:

- (void)testAnimation { 
    CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 
    [fadeInAnimation setToValue:[NSNumber numberWithFloat:1.0]]; 
    fadeInAnimation.fillMode = kCAFillModeForwards; 
    fadeInAnimation.removedOnCompletion = NO; 
    // other stuff deleted to limit error possibilities...should at least compile 
} 

这发生在我建(做清理很多次),2个错误:

cd "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp" 
    setenv MACOSX_DEPLOYMENT_TARGET 10.5 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk "-L/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" "-F/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" -filelist "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/TestApp.build/Debug-iphonesimulator/TestApp.build/Objects-normal/i386/TestApp.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator/TestApp.app/TestApp" 
Undefined symbols: 
    ".objc_class_name_CABasicAnimation", referenced from: 
     [email protected][email protected][email protected] in TestClassTestClass.o 
    "_kCAFillModeForwards", referenced from: 
     _kCAFillModeForwards$non_lazy_ptr in TestClass.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 
     ".objc_class_name_CABasicAnimation", referenced from: 
      [email protected][email protected][email protected] in TestClass.o 
     "_kCAFillModeForwards", referenced from: 
      _kCAFillModeForwards$non_lazy_ptr in TestClass.o 
    ld: symbol(s) not found 
    collect2: ld returned 1 exit status 

它说未定义的符号:

我必须包含一些框架吗?

我已经包括:

CoreGraphics.framework Foundation.framework UIKit.framework

当我删除所有代码,但进口QuartzCore/QuartzCore.h的话,我没有得到任何错误。所以我敢打赌,进口的作品,但不知道。

解决

我错过了包括QuartzCore框架!

+0

也许不要问这个问题,你可以保留在这里的评论中的回应:http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-沿着弯曲的路径观看或者图像1143095#1143095 – 2009-07-21 12:54:39

+0

如果你写了一个清晰的问题并且答案很明确,让我告诉你:你的计划失败了! – 2009-07-21 13:32:16

回答

7

您是否正在将石英导入标题中?

#import <QuartzCore/QuartzCore.h> 

QuartzCore包括CAAnimation头

7

也许你并没有包括在项目中Quartz框架。

要做到这一点,选择您的应用程序的目标,到构建阶段选项卡,然后在链接二进制与图书馆添加QuartzCore.framework