私はすべてのUIViewControllerでcocos2dシーンを実装する2つのUIViewControllerを持っています。 "Page2"ボタンをタップすると、2番目のView Controllerに変わります。 2番目のView Controllerで "Back"ボタンをタップすると、最初のView Controllerに変わります。この後私のUIViewの私のcocos2Dシーンが応答しないのはなぜですか?
[[CCDirector sharedDirector] end];
p2 = [[Page2ViewController alloc] initWithNibName:@"Page2ViewController" bundle:nil];
[UIView beginAnimations:@"Page2" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:p2.view];
[UIView commitAnimations];
、まだcocos2dのシーンで応答ページ2:
これが私の "ページ2" ボタンのコードです。私が "戻る"ボタンを押すと、私のcocos2dシーンは応答しませんが、エラーはなく、警告も、メッセージもありません。私はviewDidLoad、viewWillAppear、viewDidAppearにNSLogを入れようとしましたが、これは私のコードに渡されません。これは私の "戻る"ボタンコードです。
[[CCDirector sharedDirector] end];
[UIView beginAnimations:@"Back to Home" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view.superview cache:YES];
[self.view removeFromSuperview];
[UIView commitAnimations];
任意のアイデア..... CCDirectorにend
を呼び出さないでください
" UIViewControllerごとにcocos2dシーンを設定しました。他のアイデア?ありがとう –
うん、あなたrunWithSceneの代わりにreplaceSceneを使用する必要があります。 RunWithSceneは、最初のシーンをロードするためにのみ使用できます。 – LearnCocos2D