Search code examples
iosipaduisplitviewcontrolleruisplitview

Change RootViewController inside UISplitView


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.


Solution

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