Search code examples
objective-cuser-interfaceuiviewcontrolleruisplitviewcontroller

UISplitViewController customization


I want to add a sidebar navigation like Kayak (see image), but I'm not sure how. The only way I can think of is adding a UIView to each of my main ViewControllers and then changing AppDelegate.window.rootViewController but I'm not sure.

Also, I want to make sure this works with UISplitViewControllers and I've had a hard time customizing this class.

Any help appreciated, thanks.

Kayak Navigation


Solution

  • I would create a container view controller which has a side bar. Then add other view controllers to that container view controller as child view controller. By sidebar button actions you can switch (add / remove...) views of your child controllers( handled by container view controller ).

    I did not understand you exactly:

    if you want to use split view controller for that sidebar

    UISplitviewcontroller has a master view (left view) with 320.0 px (non retina). Changing this value is not advised by apple.

    or if you want to use a split view controller next to sidebar

    split view controller has been made to be a root view controller of the app window. So it is not good to it here. Maybe you can create your own.

    I do not think it is a good idea changing the root view controller of your window. Even if you do that you need to have a sidebar in every your views, which is not good.