我使用故事板生成了一个新的选项卡式应用程序。
到目前为止我有
TabBarController -> FirstViewController -> SecondViewController -> ModalViewController
我试图在显示 tabBarController 之前打开模式视图。我在 AppDelegate.m 上添加了以下代码
showModalView
被称为application:didFinishLaunchingWithOptions:;
- (void)showModalView
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
GSLoginViewController *loginView = [storyboard instantiateViewControllerWithIdentifier:@"loginView"];
[loginView setModalPresentationStyle:UIModalPresentationFullScreen];
[self.window.rootViewController presentViewController:loginView animated:YES completion:NULL];
}
这里是我的输出:
Warning: Attempt to present <ModalViewController: 0x93670d0> on
<UITabBarController: 0x935d170> whose view is not in the window hierarchy!