Nick Lasta
Nick Lasta

Reputation: 131

Navigation and Tab Bar Controller not showing up

I'm trying to use instantiateViewControllerWithIdentifier in the app delegate to show a view controller but for some reason the navigation bar and tab bar isn't show up. I'm not sure what I'm doing wrong - Thanks

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *view = (UINavigationController *)[sb instantiateViewControllerWithIdentifier:@"ShopViewController"];
self.window.rootViewController = view;

Upvotes: 0

Views: 898

Answers (1)

Reedy
Reedy

Reputation: 2076

Is ShopViewController a UINavigation controller or is it just a view controller. It sounds like you are declaring the view controller as uinavigationcontroller. Instead you should either drop a navigation controller on the storyboard and then give that an identifier OR you could just create a navigation controller in the app delegate.

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ShopViewController *showViewController = (ShopViewController *)[sb instantiateViewControllerWithIdentifier:@"ShopViewController"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:shopViewController];
self.window.rootViewController = nav;

Upvotes: 1

Related Questions