Sabeen Malik
Sabeen Malik

Reputation: 10880

Home Screen Leading into TabBar Controller

I am a total beginner to Xcode and native development. So still trying to figure out a lot of the basic stuff.

I want my app to load and display 5 tab items and not have any of them selected. The idea is to have a "Home" screen which will have the tab bar items which the user can click to move into different parts of the app. I am aware that you a tab bar item has to be in the selected state.

Is there a work around this problem?

I was thinking of having an individual view controller where the user lands when the app launches. This view will have its own tab bar view just like the tab bar controller. So when I tap any tab item, I will direct the user to the respective tab view. The best I could do was to control-drag the home tab bar item to the respective tab view, that works to the extent that it shows the view but not the tab bar from the tab bar controller.

I know its confusing, so let me know what I can do to make it clearer.

Upvotes: 0

Views: 631

Answers (1)

rdelmar
rdelmar

Reputation: 104082

You just need to add a tab bar to your initial controller (the "home" screen), and have the same titles and images in its tab bar as in the one controlled by the tab bar controller. Then, when the user selects one of the tabs, you switch the window's root view controller to the tab bar controller.

I think you could also do it with a tab bar controller by doing two things. Set the selected image of the first tab to be the same as the unselected image, so that even if that tab is selected it won't look like it. Second, have a view in the controller for the first tab that is over top the "normal" view for that controller, that is your "home" view. Just delete it or move it to the back when you want to show the normal view for that controller.

Upvotes: 1

Related Questions