0

我的故事板拆分视图应用程序有问题。我有这个弹出框控制器,但是当我按下条形按钮项目而不是在屏幕顶部弹出时,它会从侧面推动。有什么想法吗?

    - (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{    
    barButtonItem.title = NSLocalizedString(@"Master", @"Master");
    [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:barButtonItem animated:YES];
    self.popoverController =nil;
    // self.masterPopoverController = ;
}
4

1 回答 1

0

你可以试试这个:

- (void)splitViewController: (UISplitViewController*)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)popoverController {
barButtonItem.title = NSLocalizedString(@"Master", @"Master");
NSMutableArray *items = [[_toolbar items] mutableCopy];
[items insertObject:barButtonItem atIndex:0];
[_toolbar setItems:items animated:YES];
[items release];
self.popover = popoverController;

}

- (void)splitViewController: (UISplitViewController*)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {    
NSMutableArray *items = [[_toolbar items] mutableCopy];
[items removeObjectAtIndex:0];
[_toolbar setItems:items animated:YES];
[items release];
self.popover = nil;

}

于 2012-06-27T05:42:40.720 回答