I'm trying to present modally a UITableViewController from a view controller in my navigation controller hierarchy. The modal view should display a toolbar.
Can the navigation controller's managed toolbar be used in view controllers presented modally or should I implement my own toolbar for these?
- If I present the controller modally with
[self.navigationController presentModalViewController:filterVC animated:YES];
no toolbar is displayed. - If I pushed the controller with:
[self.navigationController pushViewController:filterVC animated:YES];
the toolbar is displayed.
Here is the method I run from the init method of my UITableViewController.
-(void)configureToolBar {
[self.navigationController setToolbarHidden:NO animated:YES];
//ToolbarItem Done
UIBarButtonItem *doneItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(doneButtonPressed)];
//ToolbarItem Cancel
UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(cancelButtonPressed)];
//Flexible Space
UIBarButtonItem *flexibleItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
self.toolbarItems = [NSArray arrayWithObjects:flexibleItem, cancelItem, doneItem, flexibleItem, nil];
[doneItem release];
[cancelItem release];
[flexibleItem release];
}