01 MayCustom UISplitViewController for iPad

Fork me on GitHubOriginal UISplitViewController 

What important Apple says about its split (iPad-Specific Controllers):

  • A split view controller must always be the root of any interface you create.
  • The panes of your split-view interface may then contain navigation controllers, tab bar controllers,…
  • … the split view controller automatically handles most of the rotation behaviors
Everything is awesome except that we can’t use UISplitViewController inside TabBars. I’m sure there is a readon for that but sometime we need a bit more flexibility.


APSplitViewController 

The main reason for custom UISplitViewController — it’s possible to be extended. For now:

  • it always keeps both sides visible
  • it’s always launched in the Portrait but rotated to any direction properly
  • each side contains UINavigationController so it’s easy to do any navigation by pushing and poping UIViewControllers
  • any number of APSplitViewController can be used inside tabs of UITabBarController (APCustomTabBarController included)

Future releases

Besides APSplitViewController is used in 3 real project it’s still in the initial stage. Functionality was gutted because it was necessary to get the component working well in a short time, and other such developments had sinned in those places that were critical to the projects. That’s why we’ve built this.

I want in future releases:

  • launch with landscape mode (now it makes 20px shift)
  • optionally hide left side in Portrait
  • the divider to be drawn in CoreGraphics instead of PNG image
  • optionally move divider in runtime

Fork APSplitViewController on Github

  • http://www.blogger.com/profile/04579596715844846425 Palaniraja

    Hi Slava,

    Congrats, Good job.
    Pls have a look at https://github.com/mattgemmell/MGSplitViewController for dynamic divider.

  • http://www.blogger.com/profile/10136059479406321000 Slava

    Yes, i've seen that. But it's not helpful to me. Don't want to let user to much flexibility.

  • http://www.blogger.com/profile/10136059479406321000 Slava

    Finally, the sample project of APSplitViewController is refactored and updated.
    https://github.com/slatvick/APSplitViewController

  • http://www.blogger.com/profile/04234113527565883077 Chris

    Dude, this is awesome! Keep up the good work!

  • https://launchpad.net/~launch-mailinator-com launch-mailinator-com
  • http://www.blogger.com/profile/10136059479406321000 Slava

    Thanks. URL was fixed.
    Later I will move it to https://github.com/SlavaBushtruk/APSplitViewController

  • http://www.blogger.com/profile/02762575676788508771 Danilo

    Hi Slava,

    the problem is still occurring when the application opens with the landscape mode by default as in my case, any idea how to resolve this bug?

  • http://www.blogger.com/profile/10136059479406321000 Slava

    Yes, it's still NOT supported.
    It's a feature! :)

  • http://www.blogger.com/profile/01493049932438818132 Andy

    How hard is it to hide the left side viewcontroller on portrait mode? I would like the portrait to behave like the default template in XCode.

  • Andrew

    Great app which is very helpful as I try to convert my iPhone app to a Universal app – like the iPad Settings app. However, as another poster has commented, it will not open correctly when the device is in landscape mode.

  • Andrew

    I’m trying to push a TableViewcontroller (FR2ViewController) to the Detail (Right) view using the SimpleSplitController from a TableViewController(FR1ViewController)in the Detail view using:

    SimpleSplitController *simpleSplitController = [[NSClassFromString(@"SimpleSplitController") alloc] init];
    if (simpleSplitController != nil){
    [simpleSplitController.detail pushViewController:fr2ViewController animated:YES];
    simpleSplitController release];

    but am not having any success – nothing happens. Can anyone see what is wrong with my code? BTW, FR2Controller is instantiated earlier.

  • Andrew

    Sorry, the code should be:

    SimpleSplitController *simpleSplitController = [[NSClassFromString(@"SimpleSplitController") alloc] init];
    if (simpleSplitController != nil){
    [simpleSplitController.detail pushViewController:fr2ViewController animated:YES];
    [simpleSplitController release];
    }

    but am not having any success – nothing happens. Can anyone see what is wrong with my code? BTW, fr2View Controller is instantiated earlier and SimpleSplitController.h is imported.

    • Andrew

      I’m not having any luck with this – I cannot figure out how to push a view to the Detail pane of the SimpleSplitController from another class. Any help would be appreciated.

      • Andrew

        Never mind. Writing SimpleSplitController’s self.Detail property to a property of the app’s delegate and using that property to push new views works fine.