How to remove button for popover in splitview with tabbar

Discussion in 'iOS Programming' started by mikezang, Aug 16, 2010.

  1. mikezang
    Expand Collapse
    macrumors 6502a

    May 22, 2010
    Tokyo, Japan
    I made a TabBarController, there is a SplitViewController in one tab. The Split View is no any problems, but when I switch tabs at portrait mode, I found a problem due to this undocument structure. I use code as below for split view, I am not sure how to inform it to remove button when switched tabs, pls give a hint.
    - (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
        barButtonItem.title = @"Master List";
        NSMutableArray *items = [[toolbar items] mutableCopy];
        [items insertObject:barButtonItem atIndex:0];
        [toolbar setItems:items animated:YES];
        [items release];
        self.popoverController = pc;
    // Called when the view is shown again in the split view, invalidating the button and popover controller.
    - (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
    	NSMutableArray *items = [[toolbar items] mutableCopy];
        [items removeObjectAtIndex:0];
        [toolbar setItems:items animated:YES];
        [items release];
        self.popoverController = nil;

    Attached Files:

Share This Page