使 UIButton 添加数据到核心数据模型
大家好,这几天一直在摸索这个问题,但仍然不知道该怎么做。
我有一个 UIButton,通过单击它,我希望它将数据添加到我的核心数据模型中。目前,我正在使用 Core Data UITableViewController 中的 navigationItem.rightBarButtonItem = addButton; 来添加数据,但我喜欢将 UIViewController 连接到核心数据模型,并让 UIButton 向其中添加数据。
例如,当单击此 UI 按钮时,它将更改为另一个视图,同时还将数据添加到核心数据模型。
-(IBAction)changeviewandadddata {
SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:screen animated:YES];
[screen release];
任何有关
如何执行此操作的帮助或建议将不胜感激。
Hey all, been scratching my head at this for a couple of days now, but still have no idea how to do it.
I have an UIButton, by clicking it I would like it to add data to my Core Data model. At the moment I'm using navigationItem.rightBarButtonItem = addButton;
from my Core Data UITableViewController to add data, but instead I like to connect a UIViewController to the core data model and have an UIButton add data to it.
For example, when this UIbutton is click, it would change to another view while also adding data to the core data model.
-(IBAction)changeviewandadddata {
SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:screen animated:YES];
[screen release];
}
Any help or suggestions on how to do this would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是将数据插入核心数据存储的示例。
Here is a sample to insert data into a Core Data store.