hmzfier
hmzfier

Reputation: 554

Xcode Multiple viewcontrollers for a Tab in a TabBar Controller

I have multiple viewcontrollers for a single tab in a tabbar controller.

In the initial viewcontroller, it shows the tabbar with two items. There is also a button that takes you to the second viewcontroller. I want the second viewcontroller to have the initial tabbar controller with the two items. It currently displays no tabbar controller.

How do I achieve this?

enter image description here

Thank you in advance.

Upvotes: 0

Views: 207

Answers (3)

hmzfier
hmzfier

Reputation: 554

Doh! I solved my own question.

I was using the "present modally" segue, when instead, the "show" segue will automatically include the root tabbar and navigation controller.

Upvotes: 0

ShahiM
ShahiM

Reputation: 3268

use this methood in the UIViewController class where you want to hide/not hide the tabBarController

-(BOOL)hidesBottomBarWhenPushed
{
    return NO;
}

See also : this question is the exact opposite to yours, but see if you can make some use of it.

Upvotes: 0

Snacks
Snacks

Reputation: 513

Try embedding the two view controllers in a container, and only show the container from the tabbar controller. This way you can only realod what is inside the container, and the tabs will be always visible.

Upvotes: 1

Related Questions