我正在使用 PKRevealController 来显示 SideBar,所以在 AppDelegate 中我有这个来设置 UINavigationController 和我的 ViewControllers:
FirstViewController *firstController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *menuViewController = [[UINavigationController alloc] initWithRootViewController:firstController];
UIViewController *sideViewController = [[SideViewController alloc] init];
self.revealController = [PKRevealController revealControllerWithFrontViewController:menuViewController leftViewController:sideViewController options:nil];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
这是可行的,并且 firstViewController 与侧栏(sideViewController)一起显示
但现在我需要设置 cocos2d 场景,通常你需要设置 navController,这可能是我有点困惑的地方,这就是我想要做的:
CCGLView *glView = [CCGLView viewWithFrame:[window_ bounds]
pixelFormat:kEAGLColorFormatRGB565
depthFormat:0
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
navController_ = [[MyNavigationController alloc] initWithRootViewController:self.revealController];
navController_.navigationBarHidden = YES;
[window_ setRootViewController:navController_];
[self.window makeKeyAndVisible];
甚至没有调用方法directorDiDReshapeProjection!
-(void) directorDidReshapeProjection:(CCDirector*)director
{
NSLog(@"called");
if(director.runningScene == nil) {
NSLog(@"if statement called");
[director runWithScene: [IntroLayer scene]];
}
}
我基本上用一个按钮调用该方法,使用 transitionFromViewController:toViewController: 方法
[self transitionFromViewController::firstController toViewController:[CCDirector sharedDirector] duration:1.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
} completion:^(BOOL finished){if (finished) {
firstController=[CCDirector sharedDirector];
}}];
过渡正在进行,但“另一边”是黑色的场景。而且,正如我所说,没有调用directorDidReshapeProjection 方法:\
顺便说一句,我在其他游戏中使用这种方法,它们正在工作,只是在这里我使用了 PKRevealController,它正在使用 UINavigationController,我的方法不起作用
有人可以向我解释为什么吗?我在 UINavigationControllers 上做错了什么?(我很确定这是问题所在)