我現在面臨一個問題想我UIViewController
鏈接,但我得到了我最後的錯誤。代碼不能在窗口層次結構的根視圖
Attempt to present ViewController whose view is not in the window hierarchy
這裏是我的代碼:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Wokay"])
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"Vibes"];
[self.window.rootViewController presentViewController:vc animated:YES completion:nil];
}
}
代碼錯誤:
Warning: Attempt to present <ViewController: 0x110634bc0> on <Login: 0x10951e7f0> whose view is not in the window hierarchy!
你能複製粘貼詳細錯誤嗎? – highwing
如果根視圖控制器的視圖當前不在窗口層次結構中,則無法執行此操作。 – rdelmar
@highwing,只是增加 – user3546239