2009-07-21 59 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