您的位置:首页 > 其它

应用第一次启动,修改rootViewController方法

2017-07-20 09:56 435 查看
1、第一次设置C代码


self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

NewEntryController *controller = [[NewEntryController alloc] initWithNibName:@"NewEntryController" bundle:nil];

self.window.rootViewController = [[GKNavigationController alloc] initWithRootViewController:controller];

[self.window makeKeyAndVisible];

return;

2、修改rootViewControllerC代码


AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

// 在delegate中初始化新的controller

[delegate initTabbarController];

// 修改rootViewController

[delegate.window addSubview:delegate.tabbarController.view];

[self.view removeFromSuperview];

delegate.window.rootViewController = delegate.tabbarController;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息