UITableViewController doesn't show toolbar items?

I have been looking for this problem ever since. I have a table view controller with a navigation bar and a toolbar at the bottom. I can show the toolbar

self.navigationController.toolbaHidden = NO;

Then I added some elements to a toolbar like this

UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
button.titleLabel.text = @"Button";
UIBarButtonItem *buttonItem = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease];
[self setToolbarItems:[NSArray arrayWithObject:buttonItem] animated:NO];
[button release];

However, it never works. I think this is the right way, but somehow it does not show anything on the toolbar. Does anyone know what the reason is? Or, if you know the correct way to add toolbar items, please let me know? Many thanks to the guys.

Greetings

+3
source share
2 answers
 UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:nil];
     UIBarButtonItem *buttonItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:nil];
  self.toolbarItems=[NSArray arrayWithObjects:buttonItem,buttonItem2,nil];
    self.navigationController.toolbarHidden = NO;

, , , , , , , ,

+5

, , .

, , ...

0

All Articles