Search code examples
objective-cioscocoa-touchuisplitviewcontroller

MGSplitViewController change detail view controller


Using MGSplitViewController, how do I change the detail view controller? There's a property declared:

@property (nonatomic, retain) IBOutlet UIViewController *detailViewController; // convenience.

doing splitVC.detailViewController = myVC; has not effect. Instead I have to do splitVC.viewControllers = @[masterVC, myVC];. It works, but is this the right way?

Thanks!


Solution

  • You are doing it right. From UISplitViewController Reference:

    The split view controller has no significant interface of its own. Its job is to manage the presentation of its two child view controllers and transitions between different orientations.

    also:

    You must assign two view controllers to a split view controller. Usually you configure these view controllers in a storyboard; if you create a split view controller programmatically, you assign them using the viewControllers property.