ios - 后退按钮突然不再出现在导航栏中

标签 ios swift uinavigationcontroller uistoryboard

我为我的应用程序构建了一个简单的“关于”页面,它只是一个带有本地 HTML 的 webView。我的设置包含在单独的 Storyboard中,而 AboutViewController 是该 Storyboard中的一个 View 。

当 AboutViewController 出现时,它不再显示返回设置的后退按钮。

过去两周一直工作得很好,今天突然停止工作了。有没有更好的方法将 View 推送到导航 Controller 上?

let storyboard = UIStoryboard(name: "Settings", bundle: nil)

let aboutViewController = storyboard.instantiateViewControllerWithIdentifier("AboutViewController") as! AboutViewController

self.navigationController?.pushViewController(aboutViewController, animated: true)

self.tableView.deselectRowAtIndexPath(indexPath, animated: true)

我的手机上运行的应用程序版本稍旧,如下所示: old (correct) view

现在看起来像这样: new (incorrect) view

最佳答案

解决方法是自己把它放回去。

override func viewWillAppear(animated: Bool)
{
     super.viewWillAppear(animated)
     navigationItem.leftBarButtonItem = UIBarButtonItem(title: "< Back", style: UIBarButtonItemStyle.Plain, target: self, action: "back")
}

func back()
{
    navigationController?.popViewControllerAnimated(true)
}

关于ios - 后退按钮突然不再出现在导航栏中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32973008/

相关文章:

iphone - 使用 Mac 应用程序从 itunes 获取 UDID

ios - 在 UIImage 上使用 Core Graphic 绘制渐变结果不一致

swift - 使用 swift 将多值条目插入数组

ios - webView 中的网页填充问题 swift 3

ios - 将返回按钮添加到 iOS 中导航 Controller 的第一个屏幕

ios - 将信息从 UINavigationController 传递到嵌入式 UIViewController

ios - iPhone 核心数据 "Automatic Lightweight Migration"

ios - 具有水平和垂直分页的 UICollectionViewLayout

ios - 如何执行从 UIView 到 ViewController 的导航

IOS 12 决定键盘类型,即使我通过代码更改它