【发布时间】:2014-01-14 09:21:36
【问题描述】:
从一个视图(LoginTesteInicial)我可以转到两个 tabBarControllers,但是当我运行代码时,它会因以下错误而崩溃:
Attempt to present <UITabBarController: 0x8a4a870> on <LoginTesteInicial: 0x8a46970> whose view is not in the window hierarchy!
这是我来自LoginTesteInicial.m的代码:
UITabBarController *vc;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
vc = [[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarSemLogin"];
} else {
vc = [[UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarSemLogin"];
}
[vc setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:vc animated:YES completion:nil];
【问题讨论】:
-
你是在 viewDidLoad 中调用它吗?
标签: ios viewcontroller tabbar