当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - using relationship with Core Data On iOS

问题描述:

I have 2 entries

1. category (main one)

2. info

the relationship is 1 to many , for every category there is several info's

after i added the several info classes to each categoty

i want to get each category relationship list in the detailsviewcontroller

I created a temp class in the details view the contain the selected category

how do i get access to the list of INFO'S ??

网友答案:

Without seeing your code or model classes, I can't give you the exact answer. But when you made your model, you probably named your relationship something like "infosForCategory". When you generated the model it made a NSMutableSet for that 1-to-many relationship. In that case, you can access the list of infos with:

NSMutableSet *myInfos = myCategory.infosForCategory;
网友答案:

I'm not exactly sure what you're asking but it sounds like you already have an instance of Category and you want to retrieve all the related instances of Info. In that case, Category should have an automatically generated info property that is of the NSSet type. That set will contain all of the related Info objects.

分享给朋友:
您可能感兴趣的文章:
随机阅读: