一般APP首次啟動,會有登錄界面惠勒,需要在AppDelegate里設(shè)置rootViewController
self.window.rootViewController = loginVC;
//登錄成功后赚抡,切換根視圖,上一個根視圖自動釋放
UITabBarController *tabbar = [[UITabBarController alloc] init];
[UIApplication sharedApplication].keyWindow.rootViewController = tabbar;
如果纠屋,根視圖為A涂臣,A --> loginVC是經(jīng)過 present 模態(tài)跳轉(zhuǎn)過來的
self.window.rootViewController = A;
......
//模態(tài)跳轉(zhuǎn)
[A presentViewController:nav animated:YES completion:nil];
//登錄成功后,切換根視圖售担,需要dismiss釋放上一個根視圖
[self dismissViewControllerAnimated:NO completion:^{
UITabBarController *tabbar = [[UITabBarController alloc] init];
[UIApplication sharedApplication].keyWindow.rootViewController = tabbar;
}];