我正在尝试在app委托中使用instantiateViewControllerWithIdentifier来显示视图控制器但由于某种原因导航栏和标签栏未显示。我不确定我做错了什么 - 谢谢
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *view = (UINavigationController *)[sb instantiateViewControllerWithIdentifier:@"ShopViewController"];
self.window.rootViewController = view;
答案 0 :(得分:1)
ShopViewController是UINavigation控制器还是只是一个视图控制器。听起来你将视图控制器声明为uinavigationcontroller。 相反,你应该在故事板上放一个导航控制器,然后给它一个标识符,或者你可以在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;