2016-07-07 25 views
0

我有一個表視圖控制器連接到選項卡欄控制器,一切工作正常。然後,我有一個簡單的視圖控制器,用戶可以創建一個新的帖子,然後使用「新帖子」按鈕從表格視圖控制器傳遞到此視圖,然後用戶可以單擊「發佈」並返回到表格視圖或者按下「返回」按鈕。一切正常,但從視圖返回到表視圖時,標籤欄消失。我把故事板的照片:the main.storyboard從另一個視圖返回到表視圖控制器時,選項卡消失

+1

不要使用SEGUE返回到以前的視圖控制器。你需要使用* unwind segue *。請參閱:http://stackoverflow.com/a/13106216/1630618 – vacawama

回答

0

就像@vacawama建議你不應該使用節目segue而是解開segue。但是,你也可以做到這一點在像這樣的代碼,如果你的CustomViewController處於UINavigationController

@IBAction func backButtonPressed(sender: UIButton) { 
    self.navigationController.popViewControllerAnimated(true) 
} 

或者在呈現模式是這樣的:

@IBAction func backButtonPressed(sender: UIButton) { 
    self.dismissViewControllerAnimated(true, completion: nil) 
} 
相關問題