我有一个searchcontrollerviewcontroller,detailviewcontroller和一个filterviewcontroller
在Appdelegate中,我添加了前两个作为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];
}
但没有任何反应,popover适用于detailview但不适用于filterview .... 我忘记了什么吗?