Search code examples
iosswiftuitabbarunwind-segue

Unwind segue hides UITabBar using Swift


Good afternoon,

I'm trying to perform an Unwind segue from a ViewController to the parentViewController, but for some reason it's working but instead of showing the parentViewController wit the UITabBar (because everything is inside a TabBarController) it's showing the parentViewController without the UITabBar.

The question is: How can I perform an "unwind segue" and make visible the UITabBar in my parentViewController?

I perform the first segue (from parent to ViewController) using a segue "present modally" with "current context", and I use this because I need to show the UITabBar also in the ViewController.

That's my first segue (from parent to ViewController):

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
    if segue.identifier == "showPost" {
        if let indexPath = self.tableView.indexPathForSelectedRow {

            let navVC = segue.destinationViewController as! UINavigationController

            let childVC = navVC.viewControllers.first as! PostViewController

            childVC.id_post = posts[indexPath.row].idPost
        }
    }
}

And that's my unwind segue:

@IBAction func backToPosts(segue:UIStoryboardSegue) {}

Here you are and screenshot of my Storyboard:

enter image description here

Thanks in advance,

Regards.


Solution

  • If someone is having the same problem:

    I removed the NavigationController after the TabBarController.

    Regards