Problem adding UIBarButtonItems to a ToolBar
- by Olivier de Jonge
I have a UINavigationController with a UITableViewController in it. I want to show a ToolBar on the bottom with UIBarButtonItem's. The ToolBar is showing up, but the buttons won't appear. Anyone knows why?
- (void)viewDidLoad {
[super viewDidLoad];
[[self navigationItem] setTitle:@"Selections List"];
[[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addProjectSearch:)] autorelease]];
[[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
[[super tableView] setDataSource: self];
[[super tableView] setDelegate: self];
//Toolbar
UIBarButtonItem * logoutButton = [[[UIBarButtonItem alloc] initWithTitle:@"Log out" style:UIBarButtonItemStylePlain target:self action:@selector(logOut:)]autorelease];
NSMutableArray * arr = [NSMutableArray arrayWithObjects:logoutButton, nil];
[[self navigationController] setToolbarHidden: NO animated:YES];
[[self navigationController] setToolbarItems:arr animated:YES];
}