怎麼樣顯示導航控制器的登錄viewcontroller作爲它的根在模態上的home viewcontroller? 如果您不需要像註冊一樣顯示另一個視圖控制器,您可以以模態形式呈現它,而無需將其嵌入到導航控制器中。
例如,我這樣做是在AppDelegate中didFinishLaunchingWithOptions
方法
UINavigationController *homeNavigationController = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"homeNavigationController"]; // the navigation Controller that has HomeViewController as its root
[self.window setRootViewController: homeNavigationController];
[self.window makeKeyAndVisible];
if (![User isUserRegistered]) { //if user is not registered show login screens
UIViewController *introNavigationController = [mainStoryboard instantiateViewControllerWithIdentifier: @"IntroNavigationController"]; // the navigation Controller that has LoginViewController as its root
[self.window.rootViewController presentViewController:introNavigationController animated:NO completion:nil];
}
寫一些字顯示的代碼你使用 – Wain 2014-10-26 16:52:51
@Wain剛剛編輯了這個問題,謝謝 – 2014-10-26 17:02:50