small medium large xlarge

Back to: All Forums  Core Data
Seanv2_pragsmall
08 Jul 2009, 16:43
Sean Kline (4 posts)

This has the potential to be a great book. Up through chapter 2, it does a very nice job of walking someone through how to build a Core Data application. Starting with chapter 3, however, it seems to shift into a more conceptual mode. I think that the book would be stronger if it continued a little bit of a “cookbook” mode to walk the reader through implementing the concepts discussed. In any event, the book has been very helpful.

A question regarding pre-populating an entity. I see how that is done for the pop-up button. What if you wanted to pre-populate a set of recipe types that you would use every week (imagine a restaurant with a changing menu) that would display in one column of a table and then have other columns from other entities. Any suggestions?

Avatarsmall_pragsmall
27 Jul 2009, 05:57
Marcus S. Zarra (284 posts)

There are several possible solutions depending on your entity layout. If you can post the layout of the entities in your core data model I can give you further advice.

Seanv2_pragsmall
30 Jul 2009, 12:29
Sean Kline (4 posts)

Quincey Morris at CocoaDev helped me out. Here is the layout:

Entity Attributes Relationships ——– ———- ————— WeeklyMenu date menuItems (To-many Destination: MenuItems) MenuItems dish week (Destination: WeeklyMenu) chef cost Category chef dish

I pre-populate Category from a .plist.

Chef Dish —— ——- LunchChef BLT LunchChef Soup DinnerChef Soup DinnerChef Salad DinnerChef Steak

I ended up using awakeFromInsert in the implementation file for WeeklyMenu class. Figuring out how to actually do this was not very intuitive for me, but after pouring through enough example code and trial and error, it worked. My next challenge is creating a Setup Assistant (I am using Preferences… for this….not sure if this is the right approach) to configure the default values the first time the user runs the application. Now, I have to understand how be able to work with Core Data in the PreferenceController class. Again, not intuitive for me, but I guess that is the learning curve :-)

Seanv2_pragsmall
30 Jul 2009, 12:30
Sean Kline (4 posts)

Sorry about the formatting…I do not know if that was from the cut and paste, but hopefully you understand what I mean.

You must be logged in to comment