1

嗨,大家好,

我有一个带有导航控制器的导航栏。在我的一个观点中,我想添加一个自定义右栏按钮项。我正在尝试使用以下代码执行此操作,但它没有发生!任何人都可以帮助我吗?

比。

代码:

////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
4

1 回答 1

4

可能在第二行调用 navigationController 是多余的,尝试删除它:

self.navigationItem.rightBarButtonItem = saveButton;
于 2011-06-03T14:32:03.763 回答