接收 UINavBar 项目操作
- (void)viewDidLoad
{
//So I created a NavBar Item in my detail view
UIBarButtonItem * saveButton =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self
action:@selector(saveFunc)];
self.navigationItem.rightBarButtonItem = saveButton;
}
我想编写一些代码来在用户单击导航栏中的保存按钮时保存数据。我该如何编写这个方法。我被困住了,当我通过界面生成器创建导航栏项目时,我做到了这一点,但当我通过代码创建按钮时,我遇到了麻烦。
- (void)viewDidLoad
{
//So I created a NavBar Item in my detail view
UIBarButtonItem * saveButton =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self
action:@selector(saveFunc)];
self.navigationItem.rightBarButtonItem = saveButton;
}
I want to write some code to save the data when the user clicks the save button in the NavBar. How do I write the method for this. I am stuck I did it when I created a navBar item through interface builder but I am having troubles doing it when I create the button through code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在只需实现该方法
并且不要忘记添加:
now just implement the method
and dont forget to add: