我正试图通过以下代码转到我的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委托方法中调用segue:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
答案 0 :(得分:2)
您的UIAlertView窗口是最前面的UIWindow,因此您的视图控制器无法呈现。您需要等到警报视图解除。最简单的方法是使用alertView:didDismissWithButtonIndex:
(而不是clickedButtonAtIndrx)。
答案 1 :(得分:0)
添加它,它对我有用。
lvc.modalPresentationStyle = UIModalPresentationFormSheet;
lvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[mvc presentModalViewController:lvc animated:YES];