Popover with Splitview inside

ぐ巨炮叔叔 提交于 2019-12-11 23:34:03

问题


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];

回答1:


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



来源:https://stackoverflow.com/questions/21710550/popover-with-splitview-inside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!