美文网首页
'Application windows are expecte

'Application windows are expecte

作者: ream_1489 | 来源:发表于2019-06-24 14:16 被阅读0次

UIWindow在现在的版本中需要一个根视图控制器
添加方法:

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [self.window setBackgroundColor:[UIColor blackColor]];
    self.window.rootViewController = [[UIViewController alloc] init];
    [self.window makeKeyWindow];

或者

//解决该问题的代码
    NSArray *windows = [[UIApplication sharedApplication] windows];
    for(UIWindow *window in windows) {
        if(window.rootViewController == nil){
            UIViewController *vc = [[UIViewController alloc]initWithNibName:nil
                                                                 bundle:nil];
            window.rootViewController = vc;
        }
    }
    //解决该问题的代码

相关文章

网友评论

      本文标题:'Application windows are expecte

      本文链接:https://www.haomeiwen.com/subject/tpanqctx.html