我有一個標籤欄控制器與三個選項卡,我設置編程。兩個第一個只是UIViewController
,但第三個是我從另一個故事板獲得的UISplitViewController
。一切都很好,但是當我在縱向模式下顯示主視圖時,這個顯示在標籤欄的頂部。我想繼續顯示完整的標籤欄。從分離視圖控制器的主顯示在標籤欄
試圖展示從在主視圖中的項目欄按鈕的UIAlertController
(該按鈕不會在圖像中存在)作爲酥料餅被顯示在主視圖後面時,這也產生問題。
有誰知道我該如何解決這個問題?
我把他們的方式編程是這樣(的情況下,它可以幫助):
UIViewController *view1 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"FirstView"];
UIViewController *view2 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SecondView"];
UIViewController *view3 = [[UIStoryboard storyboardWithName:@"StoryboardSplit" bundle:nil] instantiateViewControllerWithIdentifier:@"MySplitView"];
UISplitViewController *splitViewController = (UISplitViewController *)view3;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem;
splitViewController.delegate = self;
NSMutableArray *tabViewControllers = [[NSMutableArray alloc] init];
[tabViewControllers addObject:view1];
[tabViewControllers addObject:view2];
[tabViewControllers addObject:splitViewController];
[self setViewControllers:tabViewControllers];
view1.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"view1"
image:[UIImage imageNamed:@"view1"]
tag:1];
view2.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"view2"
image:[UIImage imageNamed:@"view2"]
tag:2];
view3.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"view3"
image:[UIImage imageNamed:@"view3"]
tag:3];
我認爲沒關係。您可以左滑動來隱藏它。在橫向方向一切都很好。 – 2015-03-03 14:51:03
根據文檔,'UISplitViewController'必須始終是根視圖控制器。在你的情況下,選項卡視圖控制器是根。 – HAS 2015-03-03 15:40:45
UISplitViewController不必總是iOS 8的根。請參閱[Apple開發者論壇](https://forums.developer.apple.com/thread/15118) – user3847320 2015-10-30 18:56:41