小编use*_*239的帖子

代码不在窗口层次结构根视图中

我正在尝试链接我的问题,UIViewController但我得到了最后的错误.

Attempt to present ViewController whose view is not in the window hierarchy
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

- (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];

    }
}
Run Code Online (Sandbox Code Playgroud)

代码错误:

Warning: Attempt to present <ViewController: 0x110634bc0> on <Login: 0x10951e7f0> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios ios7

5
推荐指数
1
解决办法
634
查看次数

标签 统计

ios ×1

ios7 ×1

iphone ×1

objective-c ×1

xcode ×1