UIWindow的显示问题

今天创建UIWindow的时候,显示不出来。要把window变成实例变量或者属性变量才能显示出来。

{

    UIWindow*window;

}


  window = [[UIWindow alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];

    window.rootViewController = [[UIViewController alloc]init];

    window.windowLevel = UIWindowLevelAlert;

    window.rootViewController.view.backgroundColor = [UIColor yellowColor];

    [window makeKeyAndVisible];

你可能感兴趣的:(UIWindow的显示问题)