我有一个重播级别按钮。当用户按下此重播级别按钮时,我会重置所有游戏属性以重置级别。但是,这还不够。我还想让关卡看起来是全新的,所以我想将动画添加到视图控制器,就像模态 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的代码很糟糕,我很乐意接受关于我应该如何去做的任何不同意见,但除此之外,任何人都可以帮我解决这个错误吗?
任何帮助都非常有帮助!