Adi*_*tya 5 iphone animation cocos2d-iphone adobe-director
我正在尝试在cocos2D中播放.gif动画.为此,我使用库glgif.现在,要显示动画我暂停导演,添加子视图以显示动画,动画完成后我恢复导演.但是,我无法恢复Director的状态,它显示为空白.所以我尝试了这个没有暂停和恢复这个导演,它仍然没有工作.我也尝试在动画之前分离导演并在之后添加它,甚至那不起作用.
那么有没有办法在应用程序中暂停/暂停Director并正确恢复?
谢谢.
代码示例:
[[Director sharedDirector] pause];
[[Director sharedDirector] detach];
AppDelegate *del = [[UIApplication sharedApplication] delegate];
[del.window addSubview:del.viewController.view];
[del.window makeKeyAndVisible]; // this is code to call glgif class and start anim.
//code to resume the director
AppDelegate *del = [[UIApplication sharedApplication] delegate];
[[Director sharedDirector] resume];
[[Director sharedDirector] attachInView:del.window];
MScene *m = [MScene node];
[[Director sharedDirector] replaceScene:m];
Run Code Online (Sandbox Code Playgroud)
您的一些错误可能是由于附加/分离、显示/隐藏视图造成的。我和我的团队只调用attachInView一次applicationDidFinishLoading,如果我们想在 Cocos 之上的其他视图中进行更改,我们可以使用sendToBack或bringToFront调用委托窗口实例。可能值得一试。让我知道这是否有意义,或者如果没有,我可以添加一些示例代码。