I am very new to iOS development. In my app I have a tab bar and in one of the tabs I have a UISplitViewController. My issue is that when I go to the tab it shows the Detail view first. Then I have to click the back button to get the the master view. I have found one other person having this issue on stackoverflow, but the solution was in Objective-c and I am using the storyboard (not sure how to attach a class to it) and swift, so that did not help.
It also does not work when using an ipad in portrait mode. When I shift to landscape it works fine, but just shows a black screen (no back button) in portrait mode. Any help would be appreciated. Thanks.
I am not sure what other info you need or what you want me to show, so let me know if I left something out.
adjusted appdelegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let tabBarController = self.window!.rootViewController as! UITabBarController
let splitViewController = tabBarController.viewControllers![3] as! UISplitViewController
///////////////////Always visible property
splitViewController.preferredDisplayMode = .AllVisible
///////////////////
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
splitViewController.delegate = self
return true
}
Update: ended up fixing following this answer Open UISplitViewController to Master View rather than Detail