I have an app originally made for iPhone. In one storyboard scene, there are two container views that embed two different view controllers that display a model in different ways. The user can switch between showing either of these with some toggle button.
Now I want to make the ready for iPad, where it is possible to show both embedded views at the same time. The initial intuition is to use a UISplitView
, but trying that felt like more hassle than needed:
UISplitViewController
.So, now I think: why not just keep (almost) everything the same and put the container views side by side, simulating a split view, and just keep the same old controller and logic (except that there is no need for a toggle button).
Still, split views must be there for a reason, so my question is: is this a good approach? What built in functionality and features of a split view may I be missing out on? My specific app is meant to be landscape only, so a split view automatically being nicer in portrait is not relevant for me.
At the time UISplitViewController was invented (iOS 3.2) it was illegal to create your own container view controller, i.e. a view controller whose view contained the views of other view controllers. You had to use only the container view controllers supplied by Apple. So what UISplitViewController was doing couldn't be done any other way.
In iOS 5, custom container view controllers were introduced and UISplitViewController immediately became unnecessary; it became legal to write your own alternative. I even wrote one (warning, this is iOS 5 code):
So my advice is, as long as you understand how custom container view controllers work, do what you like!