Indexed Relationships in Core Data

后端 未结 3 1783
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 10:15

I\'m just starting out with using Core Data on the iPhone SDK and I\'m looking into saving an ordered list, something like an array. However, relationships in Core Data are

3条回答
  •  太阳男子
    2020-12-24 10:18

    You could do it with another entity, like this: alt text http://gallery.me.com/davedelong/100084/Screenshot-20on-202009-07-04-20at-2010-34-56-20AM/web.jpg?ver=12467253090001

    A Document could find its actual dataItems by using something like this:

    NSSet * documentDataItems = [[document orderedDataItems] valueForKey:@"dataItem"];
    

    Likewise, a DataItem could find all its documents by doing the same:

    NSSet * dataItemDocuments = [[dataItem orderedPositions] valueForKey:@"document"];
    

提交回复
热议问题