I have a UINavigationController that gets pushed a DetailsViewController. In this DetailsViewController, I want to use the toolbar that comes with every UINavigationController (atleast, since iPhone OS3.0).
So, in viewDidLoad in my DetailsViewController I create a UIBarButtonItem, I add it to an array and hand it off to the navigation controller:
- (void) viewDidLoad {
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(selectTemplate)];
NSArray *items = [NSArray arrayWithObject: item];
TestUIAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
UINavigationController *navController = delegate.navigationController;
[navController setToolbarItems: items animated:NO];
[navController setToolbarHidden: NO animated: YES];
}
But, for some reason, while the UIToolbar is animated on to screen, the item is not added to the toolbar.
Is there some sort of specific order things have to be done with the UIToolbar for this to work?
P.S.: the application is in (forced) landscape mode and the navigationController.view has a rotation transform on it. Could that have anything to do with it ?