Tab Bar Controller

I am having a problem with my tab bar controller. When I launch my app on my phone the tab bar controller the shows like it is supposed to and show the main page to let you select your drive and length and everything then you tap the continues button and it goes to the price view to show how much you are supposed to pay. But if you tap the back button to go back to the view to select the drive type and length the tab bar controller disappears right now I have the back button set up with just a show segue. How do I fix this problem?

Accepted Reply

2 ways:

- in the IBAction of the back button, call self.dismiss


    @IBAction func btn_CloseWindow(_ sender: Any) {
        dismiss(animated: true, completion: nil)
    }


- if you have created an unwind segue func in the controller where you came from and want to return to,

    @IBAction func unwindFromNext(sender: UIStoryboardSegue) {
        print("By unwinding")
    }

control drag from the back button to the exit (at top of viewController) of its own view controller and select the name of the unwind segue you have defined.

Replies

Can you explain the setup more precisely. I do not see what the tabs are.


When I launch my app on my phone the tab bar controller the shows like it is supposed to and show the main page

So, the tabBarController is the initial view ?


to let you select your drive and length and everything

Do you select them as tabItems or through elements in the view ?


then you tap the continues button and it goes to the price view to show how much you are supposed to pay.

This is a button in the view ?

Do you implement a segue to transition ?

Or through the tabbar ?


But if you tap the back button to go back to the view to select the drive type and length the tab bar controller disappears

Is it the back button of a navigation controller ?

But you never said you had set up a navigation controller

Or is it a specific button ? If so, what is its IBAction ?


right now I have the back button set up with just a show segue. How do I fix this problem?

Probably, you should not have a show segue but an unwind segue.

Hard to be sure without more info.

You must set the button or navigation bar with button item.

If you can set it, that button is right click as drag and drop to target view.

1.) Yes, the tab bar controller is the initial view.


2.) you select them as elements in the view.


3.) Yes, it is a button in the view.


4.)The only segue that I have on the button is a show segue to the previous view.

Don't use a show segue for the back button, but dismiss the present view controller.

How would I do that?

2 ways:

- in the IBAction of the back button, call self.dismiss


    @IBAction func btn_CloseWindow(_ sender: Any) {
        dismiss(animated: true, completion: nil)
    }


- if you have created an unwind segue func in the controller where you came from and want to return to,

    @IBAction func unwindFromNext(sender: UIStoryboardSegue) {
        print("By unwinding")
    }

control drag from the back button to the exit (at top of viewController) of its own view controller and select the name of the unwind segue you have defined.