Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add SplitViewController view trouble under iOS5

When I trying to add SplitViewController to view hierarchy application terminates with:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] must not be called with nil.'

SplitViewController *viewController = [[SplitViewController alloc] init];
[self.window addSubview:viewController.view];

Where SplitViewController subclass of UISplitViewController

I don't understand which popover it means. This trouble appear only on iOS5.

like image 964
andrew.turkin Avatar asked Apr 16 '26 09:04

andrew.turkin


1 Answers

After initializing viewController, you should set its viewControllers with viewController.viewControllers = [NSArray arrayWithObjects:leftNavigationController, rightNavigationController, nil];

Else, your SplitViewController does not know what to display on the left and on the right.

Pay attention also to the delegate.

Please check if this helps :)

like image 77
FernandoH Avatar answered Apr 18 '26 01:04

FernandoH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!