PresentViewController: animated: problems with displaying completion in the new ios 5.1 UISplitViewController

I ran into some problems using the UISplitViewController with presentViewController:animated:completion .

To break down the problem into its simplest form, I created a simple project with a master / detail template. In the project, I added a + button on the navigation bar of the main view. The plus button creates a navigation controller with a simple empty view. This navigation controller is then presentViewController:animated:completion using presentViewController:animated:completion . However, the presented view is displayed only in the main view, and when you reject it, the main view takes up the entire screen. I can not understand what is happening. Has anyone else encountered this problem? Here is the code.

 - (void)showViewController:(id)sender { LMTestViewController *masterView = [[LMTestViewController alloc] init]; [self presentViewController:masterView animated:YES completion:nil]; [masterView release]; } 

Thank you for your help.

+2
objective-c iphone
source share
1 answer

To present modally, use the root window view controller. Using anything else can lead to confusion in the split, especially when turning, etc.

 [self.view.window.rootViewController presentViewController:masterView animated:YES completion:NULL]; 
+6
source share

All Articles