Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitViewController portrait mode missing UIBarButtonItem

I have an application with a UISplitViewController, when I launch the app under potrait mode it's missing the "Group" UIBarButtonItem. I need to turn to landscape mode and back to potrait to make it appear. When I launch it in landscape mode it is there. Here's some screenshot to make it clear:

This is when the application is launched at portrait mode enter image description here

This is in landscape mode, after rotating it from portrait mode: enter image description here

This is after rotating back to portrait mode from landscape mode:enter image description here

like image 571
adit Avatar asked May 27 '11 02:05

adit


1 Answers

The same thing happened to me a couple days ago. You just have to make sure that the detail view is delegate of the splitView. If you try to set the delegate in the detail view's viewDidLoad, it won't be set until after the splitView loads (with the root tableView controller). That is why it is doesn't get placed until you switch to landscape and back. The best way to set the delegate is either in your app delegate implementation file (when you create the UISplitViewController, which would be the best idea) or in the root tableView controller with something like

- (void)viewDidLoad {
    self.splitViewController.delegate = [self.splitViewController.viewControllers objectAtIndex:1];
}

That makes the detail view delegate, so when it loads after the tableView controller loads, it will call your splitViewController:willHideViewController:... method.

Of course, this may not be the situation you have. I'm just assuming that since I had the exact same behavior, it is probably the same cause. If this doesn't do the trick, just say so and we'll get to the cause

like image 190
justin Avatar answered Oct 07 '22 23:10

justin