使用 Core Data 数据模型实例化新对象
基本上我有这个iPhone应用程序,它从应用程序sqlite数据库(来自实体:模块)获取有关不同模块(学生研究的主题)的数据,并将它们显示在uitableview中..当您单击一个单元格(代表一个module),它推送一个包含模块详细信息的视图控制器。
“模块”属性: name = 模块名称,body = 用户可以为模块保存的注释。
我添加了一个评估实体,其属性为:
“评估”属性: 类型 = 考试或作业,名称 = 作业名称,数据 = 到期日期
我想要做的是:
- 询问用户他们对特定模块有多少评估(例如“如何你对“模块a”有很多评估吗?”
- 然后用户会说出一个数字(例如3),然后应用程序应该以某种方式添加例如3,评估并在模块视图中为每个评估显示信息(即文本字段等)页(当用户选择模块时会被推送)
如果有人可以提供帮助,我们将不胜感激。如果我的解释有点令人困惑,我也深表歉意。
basically i have this iphone application that fetches data about different modules (subjects studied by student) from the applications sqlite database (from entity: module) and displays them in a uitableview.. at the moment when you click on a cell (that represents a module), it pushes a viewcontroller that contains details of the module.
'Module' attributes: name = module name, body = notes that user can save for the module.
i have added an assessment entity and its attributes are:
'Assessment' attributes: type = exam or assignment, name = name of assignment, data = date that it is due
What i want to do is:
- Ask the user how many assessments they have for a specific module (e.g. "how many aassessments do you have for 'module a'?"
- And then the user would say a number (e.g. 3), then the application should somehow add e.g. 3, assessments and show information (i.e. textfields etc) for each assessment in the module view page (that gets pushed when user selects a module)
If anyone can help, it would be greatly appreciated.. Also apologies if my explanation is a bit confusing..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您希望将评估与模块之间的逆关系放入其中。
然后您可以创建模块对象,
一旦分配了它们,您需要将它们推送到模态视图以控制输入,
然后您需要设置 modalViewController 以允许编辑一组中的对象。也许是一些下一个/上一个按钮,然后让它在关闭时保存上下文。
first of all you want to put an inverse relationship in from assessment back to module.
then you can create the module objects,
once they have been allocated then you need to push them to the modal view to control input
you would then need to setup the modalViewController to allow editing of the objects in a set. maybe some next/previous buttons, and then get it to save the context when dismissed.