im guessing there needs to be changes in the app delegate? Thanks for the help!
Asked
Active
Viewed 4,688 times
6
-
maybe this will help you http://stackoverflow.com/questions/29723231/use-uitabbarviewcontroller-in-portrait-but-uisplitviewcontroller-in-landscape-in – David Seek May 04 '16 at 11:44
1 Answers
14
1) Create a sample Master/Detail via xcode
2) Drag a TabBarController
on the storyboard
3) Change the TabBarController
to the initial view controller.
4) Control Drag from the TabBarController
to the SplitViewController
5) Assign a title to the SplitViewController
in the storyboard
6) In the app delegate replace the reference to the SplitViewController
as follows.
let tabBarViewController = self.window!.rootViewController as! UITabBarController
print(tabBarViewController.viewControllers?.count)
var splitViewController:UISplitViewController? = nil
for viewController in tabBarViewController.viewControllers! {
if viewController.title == "Master" {
splitViewController = viewController as? UISplitViewController
}
}
let navigationController = splitViewController!.viewControllers[splitViewController!.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController!.displayModeButtonItem()
splitViewController!.delegate = self
![](../../users/profiles/1770246.webp)
sschale
- 4,935
- 3
- 27
- 35
![](../../users/profiles/5737958.webp)
Jigar Tarsariya
- 3,051
- 2
- 11
- 36