0

I'm developing a little example for iPad from a UISplitView XCode Template. It's formed by a root controller which is shown in the left of the window and a detail view which is shown in the right.

What I want to achieve is very simple (at least I think so) but I can't find in the documentation the way to do it.

I'd like to substitute the root controller (which appears fixed in the left) with a new controller (for example as response to a event launched when you push a button). I've tried this:

ColorPicker *controlador = [[ColorPicker alloc] initWithNibName:nil bundle:nil];
[self.rootViewController presentModalViewController:controlador animated:YES];
[controlador release];

What happens with that is that the new pushed controller fills the entire window, whereas what I want is that appears fixed at the left with the two columns format that were at the beginning.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Jacob
  • 1,886
  • 2
  • 25
  • 40

2 Answers2

2

You need to set the modalPresentationStyle to an appropriate value,

controlador.modalPresentationStyle = UIModalPresentationCurrentContext;

UIModalPresentationCurrentContext instructs the view controller to appear modally within the frame of the rootViewController.

Deepak Danduprolu
  • 44,595
  • 12
  • 101
  • 105
1

Use pushViewController:animated instead may fix this. About ModalViewController, check document http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

Azu
  • 322
  • 1
  • 5
  • 18