我試圖提出一個模式視圖控制器上的視圖加載。不能出現modalViewController
下面的代碼:
if (!self.loginNavViewController_){
AHLoginViewController * loginVC = [[AHLoginViewController alloc] initWithNibName:@"AHLoginViewController" bundle:nil];
/*
AHTestViewController * test = [[AHTestViewController alloc] initWithNibName:@"AHTestViewController" bundle:nil];
*/
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:loginVC];
navController.modalPresentationStyle = UIModalPresentationFullScreen;
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.title = @"Login to Instagram";
self.loginNavViewController_ = navController;
[self presentModalViewController:self.loginNavViewController_ animated:YES];
if (self.loginNavViewController_ == nil){
NSLog(@"NIL");
} else {
NSLog(@"NOT NIL");
}
}
但是我沒有看到正在顯示一個模式視圖控制器。爲什麼??
在viewDidLoad中顯示模型視圖可能爲時尚早。試試viewWillAppear或viewDidAppear。 – jamihash 2012-04-28 03:41:13
@jamihash:答案爲+1。我認爲你需要發佈這個答案。由於這是一個正確的解決方案,您最早指出這一事實。 – 2012-04-28 05:17:10