UINavigationController 与 presentModalViewController [英] UINavigationController with presentModalViewController

查看:18
本文介绍了UINavigationController 与 presentModalViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实现 UINavigationController 的菜单屏幕,在该屏幕顶部,使用 presentModalViewController,我放置了另一个屏幕,我希望在该屏幕上拥有另一个 UINavigationController.我试图实现另一个导航控制器来处理新屏幕,但我要么在屏幕下方的 1/8 处得到一个导航栏,要么崩溃,要么什么也没有.我试过 [[UINavigationController alloc] initWithRootViewController:navigationConroller] 也没有成功.我只是在使用 pushViewController 来尝试将下一个 nib 放在不起作用的堆栈上.我做错了什么?

I have a menu screen that implements UINavigationController and on top of that screen, using presentModalViewController, I place another screen on which I want to have another UINavigationController. I have tried to implement another navigation controller to handle the new screen but I either get a navbar 1/8th the way down the screen and it crashes or nothing at all. I have tried [[UINavigationController alloc] initWithRootViewController:navigationConroller] with no success as well. I'm just using pushViewController to try and place the next nib on the stack which doesn't work. What am I doing wrong?

推荐答案

虽然有很多人在论坛上说苹果不允许这样做,但我已经让它工作了.你要做的是:

Although there are a lot of people saying on forums that Apple doesn't allow this I have got it to work. What you have to do is:

Map *mapScreen = [[[Map alloc] init] autorelease];
mapScreen.delegate = self;

UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:mapScreen] autorelease];

[self presentModalViewController:navController animated:YES];

这篇关于UINavigationController 与 presentModalViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆