0

我已经实现了一个 UISpliview 并且效果很好。但是我想为用户添加一个选项,通过按下主视图中的按钮来关闭主视图(因此它会执行相同的操作,这是通过触摸详细视图来欺骗的)。这可能吗?我已经更新了代码,我认为它应该可以工作,但它什么也没做?

- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
barButtonItem = _backButton;
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
self.masterPopoverController = popoverController;
}

- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:  (UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
// Called when the view is shown again in the split view, invalidating the button and popover controller.
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
self.masterPopoverController = nil; 
}

//the action, which gets called once the button is pressed. 
- (IBAction)backToFullDetailView:(id)sender
{
    [self.masterPopoverController dismissPopoverAnimated:YES];
}

Masterview 显示按钮(帮助)

4

1 回答 1

0

我相信你需要关闭你的弹出窗口。一个类似的问题已经被问到here。你正在看类似的东西[youPopoverController dismissPopoverAnimated: YES];

于 2012-09-16T14:49:09.803 回答