1

HI Everyone,

I have a navigation bar with a navigation controller. In one of my views, I want to add a custom right bar button item. I am trying to do so with the following code, but its not happening ! Can anyone kindly help me out ?

Thans.

Code:

////setup the top right save button
UIBarButtonItem *saveButton=[[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:@selector(saveClicked)];
self.navigationController.navigationItem.rightBarButtonItem=saveButton;
[saveButton release
Ahsan
  • 2,964
  • 11
  • 53
  • 96

1 Answers1

4

Probably call to navigationController in 2nd line is redundant, try to remove it:

self.navigationItem.rightBarButtonItem = saveButton;
Vladimir
  • 170,431
  • 36
  • 387
  • 313