Monday, May 20, 2013

UISplitViewController Portrait


/*Note: This works in OS versions greater than or equal to iOS 6.0
OS versions less than iOS 6.0 has a different look in its UIPopoverController and doesn't support Landscape Orientation.*/

Please do continue from where we left off in our UISplitViewController Landscape Tutorial...

1. Add <UISplitViewControllerDelegate> in PopMenuDetailViewController interface header.

2. Add UIPopoverController property in PopMenuDetailViewController interface Section.
@property (strong, nonatomic) UIPopoverController *masterPopoverController;

Synthesize this property:
@synthesize masterPopoverController;

By the way, UIPopoverController is only available in iPad. If you want to make something like this in your iPhone application, you may use third party libraries like WEPopoverController. Download it from github.

3. Copy these SplitView Delegate methods in our PopMenuDetailViewController.m file.


4. In AppDelegate.m file, add this one-line code in didFinishLaunchingWithOptions method after initializing splitViewController.
splitViewController.delegate = detailVC; 

5. Hit Run!


Download Sample Project here.

4 comments:

  1. Nice tutorial... What if I want my detail controller to have additional screens to the right ? Essentially I want the right controller to be a navigation controller I guess... not sure how I can accomplish that....thanks

    ReplyDelete
  2. Actually all articles on the web have basic information......but there is not a single one with customization.....like with multiple UIviewControllers...

    ReplyDelete
  3. great information,very informative
    http://quincetravels.com

    ReplyDelete

Blocks From one Class to Another

One popular scenario in using blocks is when you need to update your view after a web service call is finished.