ios - 添加带有后退按钮的 UINavigationController

标签 ios uinavigationcontroller

<分区>

我无法弄清楚如何将导航 Controller 添加到我的 iOS 应用程序中。我需要除“主”屏幕之外的所有 View 都有一个后退按钮,但我不知道如何添加它。

这是我的项目的链接: https://www.dropbox.com/s/sv0y3oh1aftxl95/KFBNewsroom%204.zip

最佳答案

从所有 NIB 中删除导航栏并使用导航 Controller (例如在应用程序委托(delegate)中,如 NeverBe 概述),然后通过 pushViewController 而不是 转换到子 Controller >presentViewController 就像您当前正在做的那样,您应该自动获得“后退”按钮。您还需要删除对 dismissViewControllerAnimated 的任何引用(如果有的话),因为您的后退按钮现在将为您执行 popViewControllerAnimated 操作。不过,如果您需要以编程方式在任何地方弹出,则可以使用 popViewControllerAnimated

在您的 NIB 中,您可能还需要调整模拟指标,以便您可以使用以图形方式表示的导航栏来设计 NIB,例如:

simulated metrics for nav bar

请参阅 View Controller Catalog 的导航 Controller 部分并引用UINavigationController Class Reference .

关于ios - 添加带有后退按钮的 UINavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13234526/

上一篇:iphone - 如何抹掉UIPasteboard的值(value)

下一篇:ios - 使用 Facebook SDK 发布到新闻源,无需登录

相关文章:

iphone - 测试您的 IOS 应用程序 - 对真正的应用程序内购买和最终编辑进行最终测试

objective-c - 一些恼人的警告仍然让应用程序工作但想删除

iphone - Google plus API 不会在登录时返回到应用程序

ios - 从单独的类推送新的 UIViewController

ios - 使用 UINavigationController 作为窗口的 Root View 时如何构建应用程序

ios - 如何在 Swift 中立即隐藏导航栏?

ios - 在 iOS 7 中设置方向

iphone - 导航 Controller 溢出

ios - swift 3 : Segue with navigation controller

javascript - ios iframe 仅在方向从纵向更改后不可滚动 ->横向