我想以編程方式用SplitViewController替換當前視圖。這是我的代碼。UISPlitViewController彈出按鈕丟失
ProjectNavigationController *projectNavPanel = [[ProjectNavigationController alloc] init];
[projectNavPanel setProjectIndex:[indexPath row]];
[projectNavPanel setKuluId:[[[[[appDelegate userSettingsDictionary] objectForKey:@"Projects"] objectAtIndex:[indexPath row]] objectForKey:@"Kulu Id"] intValue]];
ProjectDetailController *projectDetailPanel = [[ProjectDetailController alloc] init];
[projectDetailPanel setProjectIndex:[indexPath row]];
ProjectSplitViewController *splitRootController = [[ProjectSplitViewController alloc] init];
[splitRootController setViewControllers:[NSArray arrayWithObjects:projectNavPanel, projectDetailPanel, nil]];
[[self view] removeFromSuperview];
[[appDelegate window] setRootViewController:splitRootController];
這幾乎工作正常,只有一個例外。當加載拆分視圖控制器並處於縱向模式時,導航視圖隱藏 - 如預期的那樣 - 但詳細視圖沒有工具欄,其中有一個按鈕用於在彈出視圖中顯示導航。從我的研究中,我明白這是默認行爲。我錯過了什麼嗎? detailViewController中的內容很少,所以我沒有在這裏包含代碼,但是如果它有幫助,請告訴我。
有沒有人有任何想法? – Typhoon101