尝试使用QuartzCore动画时收到错误消息

时间:2012-08-03 20:46:46

标签: iphone ios quartz-core

我有一个重播级别按钮。当用户按下此重播级别按钮时,我重置所有游戏属性以重置级别。但是,这还不够。我也想让关卡看起来像是全新的,所以我想向视图控制器添加动画,就像模态segue的交叉溶解动画一样。为此,我将此代码添加到我的replayLevel方法中。

-(IBAction)replayLevel:(id)sender
{
//reset my levels properties
[self resetGameProperties];

//add the cool modal cross dissolve animation

CATransition *transition =[CATransition animation];
transition.duration=.5;
transition.type=kCATransitionFade;
transition.delegate=self;
[self.view.layer addAnimation:transition forKey:nil];
self.view.hidden=YES;
self.view.hidden=NO;

}

我还记得在我的界面文件中添加

#import <QuartzCore/QuartzCore.h>

并且一切似乎都很好,除非我构建并运行时收到此错误消息

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CATransition", referenced from:
      objc-class-ref in ViewController.o
  "_kCATransitionFade", referenced from:
      -[ViewController replayButton:] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

如果我的代码复制模式交叉溶解segue是坏的,我会很乐意接受任何不同的意见,我应该怎么做,但否则,任何人都可以帮我解决这个错误?

任何帮助都非常有帮助!

1 个答案:

答案 0 :(得分:1)

您需要将QuartzCore框架添加到目标。

How to "add existing frameworks" in Xcode 4?