Domanda

I want to create programmatically a UIPopoverController with a UISplitViewController inside. The Problem is that the Master-View is overlaying the Detail-View. It seems that the Master-View is popped over the Detail-View. That means i can see both, Master & Detail but the Split is not correct.

Have a look here: http://i.stack.imgur.com/En70W.png

Any idea how to solve that ? Thx

.m File

UISplitViewController *customSplitVC = [[UISplitViewController alloc] init];

ListViewController *listViewController = [[ListViewController alloc] init];
listViewController.title = @"Master";
listViewController.content = self.myContent;

UINavigationController *masterNC = [[UINavigationController alloc] initWithRootViewController:listViewController];
masterNC.view.frame = CGRectMake(0, 0, 500,  masterNC.view.frame.size.height);

DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.title = @"Detail";

UINavigationController *detaillNC = [[UINavigationController alloc] initWithRootViewController:detailViewController];
detaillNC.view.frame = CGRectMake(600, 0, 500,  detaillNC.view.frame.size.height);

[customSplitVC setViewControllers:@[masterNC, detaillNC]];

self.popover = [[UIPopoverController alloc] initWithContentViewController:customSplitVC];
self.popover.delegate = self;
self.popover.popoverContentSize = CGSizeMake(1000, 425);
[self.popover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:(UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionUp) animated:YES];
È stato utile?

Soluzione

UISPlitViewController has to be set as the root view controller, so you cannot put it inside a UIPopoverController.

You can try using a 3rd party split view controller though:

https://github.com/Raizlabs/RZSplitViewController

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top