Trying to get UISplitView
working on iPhone with different orientations.
I have two detail views setup in Storyboard - a Dashboard view, and a Webview. I would like to programmatically have the Dashboard display as the default detail view when in landscape orientation with PreferredDisplayMode .allVisible
, so that the detail view isn't blank. However this selection needs to occur only on device rotation so that in Portrait orientation the only view is the Master (Table) View.
Any ideas? I have tried to programatically select the Dashboard Tableviewcell and fire a segue at the start of device rotation using the viewWillTransition toSize
method but no luck.
Best option would be to create a simple wrapper view controller for the splitview.
The wrapper vc will be able to decide on viewWillApear if he needs to load a view controller on his own or can use a provided one.
Please see attached demo project.
We have an optional view controller in the demo project, that gets set with a random view controller. Instead we could test if we got already a view controller set and use hin instead creating one.