2015-10-06 124 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) 
}