我想以编程方式创建一个带有UISplitViewController的UIPopoverController。问题是主视图覆盖了详细视图。似乎Master-View弹出了Detail-View。这意味着我可以看到两者,Master&细节,但拆分不正确。
看看这里: http://i.stack.imgur.com/En70W.png
知道如何解决这个问题吗? THX
.m文件
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];
答案 0 :(得分:1)
UISPlitViewController必须设置为根视图控制器,因此您不能将其放在UIPopoverController中。
您可以尝试使用第三方拆分视图控制器: