2015-10-06 209 views
0

我为我的应用程序构建了一个简单的“关于”页面,它仅仅是一个带有本地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) 

我有我的手机上运行我的应用程序的一个年龄稍大的版本,它看起来像这样: old (correct) view

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

+0

检查这个http://stackoverflow.com/questions/20469089/missing-back-button-from-uiviewcontroller-in-a-navigation-controller – Max

+0

检查这个问题,以及http://stackoverflow.com/问题/ 29394194/swift-can not-show-back-button-after-hide-it – Max

+0

这些都没有帮助对不起。这太奇怪了,它在一个小时前工作,我没有更改任何与View相关的代码。 – mforrest

回答

0

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

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