Ios – Presenting a modal view controller over only one half of a split view controller

iosipadmodalviewcontrolleruisplitviewcontrolleruiviewcontroller

I'm adapting an existing iPhone app to run on the iPad. In the iPhone version, when the user tapped a toolbar button, I would present a modal view controller with a modalTransitionStyle of UIModalTransitionStyleFlipHorizontal, which made a really nice "card-flipping" animation.

The iPad interface is based on a split view (MGSplitViewController, actually). The toolbar button is on the detail pane, so when I present the modal view controller, it takes up the entire screen and the flip transition makes no sense.

To get the right user interaction, I'd like the modal controller to appear and flip into place only over the detail view controller, leaving the master view controller as is.

Is there any way to do this?

Best Answer

UIViewController *viewController = [[UIViewController alloc] init];
viewController.modalPresentationStyle = UIModalPresentationCurrentContext;

[self presentViewController:viewController animated:YES completion:nil];
Related Topic