0

I'm using a UITabBarController inside of a UISplitViewController with an iPad. On iOS12 this works fine, with the tabbar controller collapsing into a 'More' tab. enter image description here

Running the same code on iOS13 results in the tab bar controller not collapsing the views correctly, like this:

enter image description here

Edit / Update: This is reproducible with the 'Master Detail' Xcode template. Without making modifications to the code, make the root view controller of 'Master' navigation controller a tab bar controller and add >6 tabs like so: enter image description here

Results in the same mess: enter image description here

This leads me to believe it's not my own custom code that is the culprit, but rather something I don't understand about how UISplitViewControllers function within iOS13 specifically.

Has anyone run into this? I tried the solution from this question, but that unfortunately did not change anything.

Msencenb
  • 5,675
  • 11
  • 52
  • 84

1 Answers1

0

Turns out I didn't dig deep enough into the comments of the linked question. I was able to fix this by creating a brand new UISplitViewController programmatically after launch, which picks up the trait collection correctly. Code looks something like this, replacing the WIQSplitViewController with your subclass and tabController initialized to be the tabcontroller I have setup in my storyboard. I didn't initialize tabController, I simply plucked it from the splitviewcontroller the app launches with (that is broken), then change the windows root view to this new split view.

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let splitVC = storyboard.instantiateViewController(withIdentifier: "wiqSplitVC") as! WIQSplitViewController

let navVc = UINavigationController.init(rootViewController: tabController!)
splitVC.viewControllers = [navVc]

tabController?.setViewControllers(tabs, animated: false)
tabController?.selectedIndex = 0

self.window?.rootViewController = splitVC
Msencenb
  • 5,675
  • 11
  • 52
  • 84