Reputation: 879
I try to add a "add button" in the navigationBar, but the button who is created is a rectangle button with no text inside, not a "+" button, why?
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonSystemItemAdd target:self action:@selector(ajouterItem)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
Upvotes: 1
Views: 381
Reputation: 71048
You're mixing up the initializer with the one for title/style. You want this form:
- (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action
Call it like this:
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(ajouterItem)];
Upvotes: 4