UINavigationController with presentModalViewController(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UINavigationController 与 presentModalViewController
基础教程推荐
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01