Getting data from one table back to a previous one in an iPhone table based navigation app
I'm confused about how to implement a specific piec开发者_JAVA技巧e of an app. The data is being collected in a Grouped Table, but certain rows drill down to another screen to allow the user to choose something. So for example, I would have Name: Surname: Age:
How do I get this Age value back to the first view when the user taps done ?
I am creating a Person core-data entity when the user saves the first screen that persists all of this data, but that doesn't exist when the user navigates to the second view. It cannot exist as Name and Surname are required fields, so I cannot save the core-data entity unless these already exist.
Is there any way for a view to return a data type to an earlier view in the navigation tree ?
Thanks in advance,
First option:
pass it as a parameter in a custom init method
Second option:
Declare your CoreData variables in your AppDelegate and access in your views by using
NSManagedObjectContext *context = [(MyAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
精彩评论