1

I have a table view controller connected to a tab bar controller and everything works fine. Then I have a simple view controller where the user can create a new post and I pass from the table view controller to this view with a button "new post" and then the user can either click "post" and get back to the table view or by pressing the "back" button. Everything works fine but when returning back from the view to the table view the tab bar disappears. I put the photo of the storyboard: the main.storyboard

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 1
    Don't use a segue to return to the previous view controller. You need to use an *unwind segue*. See: http://stackoverflow.com/a/13106216/1630618 – vacawama Jul 07 '16 at 11:07

1 Answers1

1

Like what @vacawama suggested you should not be using a show segue but a unwind segue. However, you can also do it in code like this if your CustomViewControllerare in a UINavigationController

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

Or in a presented modal like this :

@IBAction func backButtonPressed(sender: UIButton) {
  self.dismissViewControllerAnimated(true, completion: nil)
}
Zac Kwan
  • 5,587
  • 4
  • 20
  • 27