从 Scene 切换到 ViewController
TestViewController *viewController = [[[TestViewController alloc] init] autorelease];
[[CCDirector sharedDirector].navigationController pushViewController:viewController animated:YES];
// 显示导航栏
[[CCDirector sharedDirector].navigationController setNavigationBarHidden:NO animated:NO];
从 ViewController 切换到 Scene
[[CCDirector sharedDirector]replaceScene:[HelloWorldLayer scene]];
[self.navigationController popViewControllerAnimated:YES];
// 隐藏导航栏
[[CCDirector sharedDirector].navigationController setNavigationBarHidden:YES animated:NO];

本文介绍了如何在Cocos2d-x中实现视图ViewController与Scene之间的切换,包括从Scene切换到ViewController时显示导航栏的方法,以及从ViewController返回Scene时隐藏导航栏的操作。
154

被折叠的 条评论
为什么被折叠?



