我正在尝试使用此代码连接到我的 ViewController:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone_Storyboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"details"];
[self presentViewController:vc animated:YES completion:nil];
但是我收到此错误消息:
Warning: Attempt to present <MyViewController: 0x10c5771a0> on <UINavigationController: 0x10c533da0> whose view is not in the window hierarchy!
我在 UIAlertView 委托(delegate)方法中调用 segue:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
最佳答案
您的 UIAlertView 的窗口是最前面的 UIWindow,因此您的 View Controller 无法呈现。您需要等到警报 View 消失。最简单的方法是使用 alertView:didDismissWithButtonIndex:
(而不是 clickedButtonAtIndrx)。
关于ios - 警告 : Attempt to present <MyViewController: 0x10c5771a0> on <UINavigationController: 0x10c533da0> whose view is not in the window hierarchy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20865327/