美文网首页
iOS重新设置window的rootViewController

iOS重新设置window的rootViewController

作者: 阿什不可思 | 来源:发表于2017-04-21 09:55 被阅读0次

有xib文件时的写法

<code>

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [_window release];
    // Override point for customization after application launch.
    RootViewController *rootVC = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
    //默认从包里边来找,所以是nil
    self.window.rootViewController = rootVC;
    [rootVC release];
    self.window.backgroundColor = [UIColor redColor];
    [self.window makeKeyAndVisible];
    return YES;
    }
    </code>

相关文章

网友评论

      本文标题:iOS重新设置window的rootViewController

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