Search code examples
rotationuisplitviewcontrollerios6

UISplitViewControlller master controller hiding


I am porting an app to iOS 6 and I found a solution I had deviced to trigger on and off the showing of the master view controller in a split view controller no longer works on iOS 6.

This is the piece of code I employed to trigger the action that on iOS6 just works if the device gets rotated:

- (void)hideMaster:(BOOL)hide {

[self clearOverlay];

UISplitViewController* spv = appDelegate.splitViewController;

NSLog(@"hidemaster: I do %@show the master", (hide?@"not ":@""));

self.hiddenMaster= hide;

NSLog(@"delegate=%@", spv.delegate);

[spv.view setNeedsLayout];
spv.delegate=nil;

spv.delegate=self;

}

- (BOOL)splitViewController:(UISplitViewController*)svc shouldHideViewController: (UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation {

NSLog(@"Spv: I do %@show the master", (self.hiddenMaster?@"not ":@""));

return self.hiddenMaster;
}

How do I force the shouldHideViewController callback to be triggered wthout the user rotating the device?

Thanks, Fabrizio Bartolomucci


Solution

  • I finally got rid of it by following the Apple documentation suggesting to only open it according to the user's directions. Now I restored it just for a secondary panel the user actually manually opens and than on the iPhone version is managed by an unwinding segue.