UIViewController 中的 UINavigationController

发布于 2024-09-03 03:33:49 字数 519 浏览 2 评论 0原文

我目前在基于选项卡的应用程序中有此工作流程:

Tab1 加载...

ViewOne : UIViewController
  >> 
    PickerView : UIViewController
    >> 
       DetailView : UIViewController

“>>”表示基于用户操作的负载。我想要 PickerView 和 DetailView 上的导航栏。 PickerView 只需要在其导航栏左上角有一个取消按钮。 DetailView 需要普通的导航栏后退按钮。我已经通过 IB 连接了 PickerView 的导航栏并正在工作。我不知道如何处理 PickerView 的导航栏。

PickerView 也是从 Tab2 加载的,Tab2 的主视图从 UINavigationController 开始。在这种情况下,PickerView 的导航栏工作正常。

ViewOne 不应有导航栏。

有什么想法吗?

I currently have this workflow in a tab based app:

Tab1 loads...

ViewOne : UIViewController
  >> 
    PickerView : UIViewController
    >> 
       DetailView : UIViewController

">>" means loads based on user action. I'd like navigation bars on PickerView and DetailView. PickerView just needs a cancel button in the top left of its nav bar. DetailView needs the normal navbar back button. I already have PickerView's nav bar wired up through IB and working. I'm not sure what to do with PickerView's nav bar.

PickerView is also loaded from Tab2, who's main view starts as a UINavigationController. PickerView's nav bar works fine in that case.

ViewOne should not have a navigation bar.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

能否归途做我良人 2024-09-10 03:33:49

听起来你只是做了平常的事情:在 ViewOne 中,创建导航控制器为:

UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:picker];
[self.view addSubview:nc.view];
[nc release];

自动创建后退按钮(除非你需要一个从选择器返回到 viewOne,在这种情况下创建一个。

听起来你想将 DetailView 呈现为a modal:

[selfpresentModalViewController:detailViewanimated:YES];

虽然您通常可以在导航控制器中使用它,

但当导航控制器可以为您完成这一切时,听起来您可能过于担心导航机制了?

Sounds like you just do the usual: in ViewOne, create your nav controller as:

UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:picker];
[self.view addSubview:nc.view];
[nc release];

Back buttons are created automatically (unless you need one to get back from your picker to viewOne, in which case create one.

Sounds like you want to present DetailView as a modal:

[self presentModalViewController:detailView animated:YES];

although you could just use it within a navigation controller normally.

Sounds like you are perhaps worrying too much about the mechanics of navigation when the navigation controller can do it all for you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文