【发布时间】:2013-01-17 07:59:40
【问题描述】:
我使用故事板生成了一个新的选项卡式应用程序。
目前为止
标签栏控制器 -> 第一视图控制器 -> 第二视图控制器 -> 模态视图控制器
我试图在显示 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!
【问题讨论】:
-
您可以在[这里][1]找到答案。 [1]:stackoverflow.com/questions/11862883/…
标签: ios uitabbarcontroller storyboard