开发者

problem with adding right bar button to the navbar

开发者 https://www.devze.com 2023-03-10 10:01 出处:网络
HI Everyone, I have a navigation bar with a navig开发者_开发百科ation 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 i

HI Everyone,

I have a navigation bar with a navig开发者_开发百科ation 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


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

self.navigationItem.rightBarButtonItem = saveButton;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号