开发者

How do I pass pointers back up from View 3 to View 2 to View 1 in a UINavigationController?

I'm using a UINavigationController to manage a series of views. At the top level there is a UITableView list of Equipment objects. The Equipment object are NSManagedObjects that have a to-many relationship with Note objects. The 2nd level displays all the Note objects in a UITableView that a single Equipment object has. The 3rd level allows you to edit the attributes of a single note chosen from the 2nd level.

I've been successful at passing an Equipment object and a NSManagedObjectContext from level 1, down to 2 and 2 down to three by creating an instance of the level 2 controller in level 1 and setting it's myContext and myEquipment properties. The same strategy works in going from level 2 to level 3.

How do I pass myContext and myEquipment back up from level 3 to level 2 to level 1?

Is there a smarter way to do this? I was watching a WWDC video on effective 开发者_JAVA百科app architecture and there was a section on using delegates from a similar scenario. I've watched it a couple of times and still don't get it though. They were demoing the CoreDataRecipes sample app.


Use a singleton for your CoreData setup (NSPesistentStoreCoordinator, NSManagedObjectModel & NSManagedObjectContext). You can use this singleton to execute the fetch requests you created in your Models and to add or delete Entities to your Context

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜