如何单击/迭代 coreData 实例
这是关于 如何像在邮件中那样进行下一个详细视图的另一个问题-我的应用程序。在那里,我想知道如何用数组解决这个问题。
现在我正在使用 coreData。我有一个名为 EntityAlphabet 的实体,例如,它有 5 个属性。属性在这里并不重要。 在 DetailView 中,我想迭代这个实体。 我该怎么做?
我想“切换”detailView 中的实体。
顺便说一句:我正在使用 NSFetchedResultsController 填充我的 tableView。
here is another question about how to next detailView like in Mail-App from me. There, i wanted to know how to solve that with an array.
Now i am using coreData. I have an entity named EntityAlphabet with - for example - 5 attributes. The attributes doesnt matter here.
In the DetailView, i want to iterate this Entity. How can i do that?
I want to "switch" the entitys in the detailView.
BTW: I am populating my tableView with NSFetchedResultsController.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有完全相同的情况,我只是将一个托管对象数组传递给了详细视图。然后,根据他们在详细视图上按下的向上/向下箭头,我从数组中选择适当的对象。因此,它与您提供的链接中的解决方案类似。要获取对象数组,请在 didSelectRowForIndexPath: 方法中执行以下操作:
该解决方案显然技术含量较低,由于当时(即 2 年前)缺乏知识,我实现了它。现在,我可以想到一些其他的方法来做到这一点。
希望这有帮助。祝你好运
I have the exact same situation and I just passed an array of managedObjects to the detailView. Then, based upon which up/down arrow they press on the detail view, I select the appropriate object from the array. So it would be similar to the solution from the link you provided. To get the array of objects, in your didSelectRowForIndexPath: method do something along the lines of the following:
This solution is decidedly low tech and I implemented it because of my lack of knowledge at the time, i.e. 2 years ago. Now, I could think of a couple of additional ways of doing it.
Hope this helps. Good luck
您可以以类似的方式使用 NSFetchedResultsController。尝试调用
- (id)objectAtIndexPath:(NSIndexPath *)indexPath
。将您已在- (IBAction)nextRow:(id) 发送方
中使用的 newIndexPath 传递给它。You can use NSFetchedResultsController in a similar manner. Try calling
- (id)objectAtIndexPath:(NSIndexPath *)indexPath
. Pass it the newIndexPath you are already using in your- (IBAction)nextRow:(id) sender
.