【问题标题】:Back button suddenly stopped appearing in navigation bar后退按钮突然停止出现在导航栏中
【发布时间】:2015-10-06 14:49:34
【问题描述】:

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

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

这在过去两周内运行良好,但今天突然停止工作。有没有更好的方法将视图推送到导航控制器上?

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)

我的手机上运行了一个稍旧版本的应用程序,它看起来像这样:

现在看起来像这样:

【问题讨论】:

标签: ios swift uinavigationcontroller uistoryboard


【解决方案1】:

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

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)
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-21
    • 1970-01-01
    • 2023-03-16
    • 2014-01-16
    相关资源
    最近更新 更多