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

Rootview tabbar

How to pick rootview with a tab bar controller with code?

The problem I having is that when I change the place of the log out button in ribbit to a cell when logging out and logging in again the app dosent understand what the root view is and the user will show up in settings(with out a navbar) instead of the inbox...

Any ideas?

1 Answer

Kalle,

Is this your own app or is this part of a treehouse course? It seems a little wierd to have a logout button in a cell rather then a navigation bar. In the Ribbit app they performed a segue to the login screen from the inbox. How you get to a specific view controller depends on how the view controllers setup (embedded in navigation controller) and the sequence in which they are loaded. Is your code posted on github where we can see it?

  • (IBAction)logout:(id)sender { [PFUser logOut]; [self performSegueWithIdentifier:@"showLogin" sender:self]; }

  • (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showLogin"]) { [segue.destinationViewController setHidesBottomBarWhenPushed:YES]; } else if ([segue.identifier isEqualToString:@"showImage"]) { [segue.destinationViewController setHidesBottomBarWhenPushed:YES]; ImageViewController *imageViewController = (ImageViewController *)segue.destinationViewController; imageViewController.message = self.selectedMessage; } }