我的应用程序是使用 a 设计的UITabBarController
,我试图在应用程序委托的顶部显示一个视图(登录屏幕)。当我使用以下代码时:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
tabBarController = [[UITabBarController alloc] initWithNibName:@"Main_TabBarController" bundle:nil];
self.window.rootViewController = tabBarController;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
Login_ViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"Login_ViewController"];
[self.window.rootViewController presentViewController:lvc animated:YES completion:nil];
我收到错误消息Warning: Attempt to present <Login_ViewController: 0x716fac0> on <UITabBarController: 0x7165240> whose view is not in the window hierarchy!
,屏幕只是黑屏。如何添加Login_ViewController
到窗口层次结构?