我想您的问题在于情节提要的 segue 显示弹出框控制器的方式。看起来这是一个普遍的问题。
因此,解决它的最简单方法是将模态窗口的创建移动到代码中。像这样的东西:
在你的ViewController.h
写作中
@property (strong) UIPopoverController * popoverController;
- (void) showNavigationController;
在你的ViewController.m
写作中
@synthesize popoverController;
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[super prepareForSegue:segue sender:sender];
if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]){
if (popoverController) [popoverController dismissPopoverAnimated:NO];
UIStoryboardPopoverSegue * popoverSegue = (UIStoryboardPopoverSegue *) segue;
popoverController = popoverSegue.popoverController;
}
}
- (void) showNavigationController
{
[popoverController dismissPopoverAnimated:NO];
popoverController = nil;
UIStoryboard *ub = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *controller = [ub instantiateViewControllerWithIdentifier:@"navigationController"];
[self presentModalViewController:controller animated:YES];
}
然后在您的 MainStoryboard 中navigationController
为您的导航控制器设置标识符,而不是在“显示表”按钮上设置一个“内部修饰”代表。该委托将执行您的showNavigationController
方法ViewController
(使用 a NSNotificationCenter
,例如)