我有一个 searchcontrollerviewcontroller、detailviewcontroller 和一个 filterviewcontroller
在 Appdelegate 中,我将前 2 个添加为 splitview 控制器并委托给 detailviewcontroller,如下所示:
self.splitViewController.delegate = detailViewController;
self.splitViewController.viewControllers = [NSArray arrayWithObjects:searchViewController, detailNavigationController, nil];
当 ipad 转动时,它会显示 popoverview 的按钮
- (void)splitViewController:(UISplitViewController *)splitController
willHideViewController:(UIViewController *)viewController
withBarButtonItem:(UIBarButtonItem *)barButtonItem
forPopoverController:(UIPopoverController *)popoverController{
UIBarButtonItem *filterbutton = [[UIBarButtonItem alloc]initWithTitle:@"Filter" style:UIBarButtonItemStylePlain target:nil action:@selector(showFilterPopover:)];
barButtonItem.title = NSLocalizedString(@"Search", @"Search results");
[self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:barButtonItem,filterbutton, nil] animated:YES];
self.masterPopoverController = popoverController;
}
我在这里初始化过滤视图
-(void)showFilterPopover: (id) sender{
FilterViewController *controller = [[FilterViewController alloc]initWithNibName:@"FilterViewController" bundle:nil];
UIPopoverController *popover =
[[UIPopoverController alloc] initWithContentViewController:controller];
popover.delegate = self;
self.masterPopoverController = popover;
[self.masterPopoverController
presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
但是什么也没发生,弹出框适用于详细视图,但不适用于过滤视图....我忘记了什么吗?