开发者

Core Data Relationship List

I'm not sure whether or not this is the appropriate way of doing this, but I was wondering what's the best way to approach a relationship to a value in a list with Core Data? For example, say you have a 'person' entity. Each person can have a different 'hair color'. I'm trying to basically define the hair colors 开发者_StackOverflowin my data model and allow the 'person' entity to have a relationship to their given 'hair color.

Is this possible? Good idea or bad?

Thanks in advance.


Create a HairColor entity, and use a to-one hairColor relationship in Person?

You could then create the hair colors you want on app launch if they don't already exist. Sounds to me to be a similar thing to when you populate an outline view with default items on app launch if needed (assuming the outline view uses Core Data, of course).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜