Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Thomas Nilsen
Thomas Nilsen
14,957 Points

storyboards in the advanced IOS project.

In the MainStoryBoard we have the UITabBarController, in which we can choose from "Inbox" "Friends" and "Camera". E.g. from TabBarController to NavigationController to InboxViewController, Why is InboxViewController.h inheriting from UITabBarController and NOT UINavigationController?

From what I understand, UINavigationController is used when you're going between several views as a "stack", but that still doesn't explain the inheritance part.

Thanks!

2 Answers

Stone Preston
Stone Preston
42,016 Points

inbox view controller should inherit directly from UITableViewController, since the messages are displayed in a table. WIth the inbox view, you are going between several views (login, sign up, inbox) as a stack, so you should embed a navigation controller in order to move between them. Then this navigation controller is inside the tab bar controller.

So you have your inboxViewController (which is the table view where the messages are displayed) thats inside the navigation controller thats inside the tab bar controller.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Stone answered it perfectly! It sounds like something went wrong with your project if InboxViewController is inheriting from UITabBarController. It should be inheriting from UITableViewController, and as Stone described, it's embedded in a nav controller, which is itself embedded in the tab bar controller.

The reason InboxViewController doesn't inherit from UINavigationController is because it is just the first view controller (the root view controller) within the navigation controller. It is not the navigation controller itself.

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

I'll tag Ben Jakuben in this post as he can answer this better.