應用第一次啓動,修改rootViewController方法

1、第一次設置

C代碼  收藏代碼

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

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

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

  4. [self.window makeKeyAndVisible];  

  5. return;  

 

2、修改rootViewController

C代碼  收藏代碼

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

  2. // 在delegate中初始化新的controller  

  3. [delegate initTabbarController];  

  4. // 修改rootViewController  

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

  6. [self.view removeFromSuperview];      

  7. delegate.window.rootViewController = delegate.tabbarController;  

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章