UINavigationController 视图未填满屏幕
当我使用 UINavigationController 并将其放在我的 cocos2d 视图之上(默认情况下一切都是横向的)时,它不会填满整个屏幕。尺寸基本上就像在纵向模式下一样。我花了几个小时试图弄清楚它,这让我发疯。有什么想法吗?
我可以通过将框架设置为完整尺寸来仅使用 uiviewcontroller 和视图来使其工作。
UIView* view = [[CCDirector sharedDirector] openGLView];
sssRootViewController *rooviewController = [[[sssRootViewController alloc]init]autorelease];
[[CCDirector sharedDirector] pause];
StarTravelAppDelegate *appDelegate = (StarTravelAppDelegate *)[[UIApplication sharedApplication] delegate];
rooviewController.view.frame = CGRectMake(0,0,480,320);
UINavigationController *navcontrol = appDelegate.myNavController;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rooviewController];
navcontrol.view.frame = CGRectMake(0,0,480,320);
[view addSubview:navigationController.view];
navcontrol.wantsFullScreenLayout = true;
[view addSubview: navcontrol.view];
When I use a UINavigationController and put it on top of my cocos2d view (everything is landscape by default) it doesn't fill the whole screen. The sizing is basically as if it was in portrait mode. I've spent hours trying to fgirue it out and it is driving me crazy. Any ideas?
I was able to get this to work with just a uiviewcontroller and view by setting the frame to the full size.
UIView* view = [[CCDirector sharedDirector] openGLView];
sssRootViewController *rooviewController = [[[sssRootViewController alloc]init]autorelease];
[[CCDirector sharedDirector] pause];
StarTravelAppDelegate *appDelegate = (StarTravelAppDelegate *)[[UIApplication sharedApplication] delegate];
rooviewController.view.frame = CGRectMake(0,0,480,320);
UINavigationController *navcontrol = appDelegate.myNavController;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rooviewController];
navcontrol.view.frame = CGRectMake(0,0,480,320);
[view addSubview:navigationController.view];
navcontrol.wantsFullScreenLayout = true;
[view addSubview: navcontrol.view];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先将 UIWindow 添加到您的应用程序,然后将导航控制器添加到该窗口。
First add an UIWindow to your application and then add the navigation controller to that window.
你可以尝试用这种方法调整导航栏的大小,
玩一下
希望这会有所帮助
祝你好运
you can try to resize your navigation bar in this method ,
play with this
hope this will help
good luck
您是否尝试过将框架属性设置为
Have you tried setting your frame property to