views:

357

answers:

3

i use splitview controller in my ipad application,it works ok,but sometimes when i change interface from landscape to potrait it disappear bar button and popovercontroller from the toolbar.

plz answer if anyone know about this problem.

A: 

This was a known issue with some of the iPad SDK betas. Was this project created with a beta? If so I would create a new split view project with the GM release and then copy your existing code into the new split view project.

jamone
Interesting answer, but it really is a "superstition" solution. What is the mechanism that makes the toolbar disappear? Do apps have access to that mechanism or is it completely hidden?
Gerry
A: 

I just tried with the GM, the bug still exists...

+1  A: 

I have exactly the same issue. Did anyone find a solution for this?

Thanks!


EDIT:

Found a solution. Just set the "animated" parameter to NO in the setItems method of the toolbar.

- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {

        barButtonItem.title = @"Clients";
        NSMutableArray *items = [[toolbar items] mutableCopy];
        [items insertObject:barButtonItem atIndex:0];
        [toolbar setItems:items animated:NO];
        [items release];
        self.popoverController = pc;
}

- (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {

    NSMutableArray *items = [[toolbar items] mutableCopy];
    [items removeObjectAtIndex:0];
    [toolbar setItems:items animated:NO];
    [items release];
    self.popoverController = nil;
}
federivo
Thanks Dude I was facing the same issue and after setting the toolbar animation to NO my problem got resolved. Thanks alot
sandy