I have a UIViewController which is created programmatically. I include the following code in loadView. The toolbar is shown, but not the button I added. Any help would be appreciated please.
[self.navigationController setToolbarHidden:NO animated:NO];
UIBarButtonItem *actionB = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(actionBTapped:)];
[self.navigationController.toolbar setItems:[NSArray arrayWithObject:actionB] animated:NO];
[actionB release];
You want to set the items on the UIViewController itself, not its navigation controller: