I've got a UITableViewController that's a child of a UINavigationController, and in the UITableViewController's viewDidLoad I've tried to add toolbar items like so:
self.navigationController.toolbarHidden = NO;
UIBarButtonItem *delete = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(trashButtonPressed)];
UIBarButtonItem *forward = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(actionButtonPressed)];
[self.navigationController setToolbarItems:@[delete, forward]];Unfortunately I see the toolbar, but there are no buttons. What have I done wrong?
I also tried directly setting the items on self.navigationController.toolbar but that didn't work either. I'd really rather do this directly from the storyboard, but I'm not seeing a good way to do that either.
Hmm. Ok maybe set the toolbarItems property on self rather than self.navigationController.
"When displayed, this toolbar obtains its current set of items from the
toolbarItems property of the active view controller."