Question

So I have created a Core Data application where the user enters information on a Modal View and once "Save" is pressed, it creates a cell (or adds an item to an array) in a table. Each cell pushes to a detail view where statistics can be added for each cell. My question is, how do I ensure that each detail view is unique to each item in the table, and ensure that the stats in the detail view are saved with each corresponding cell (or array item)?

Was it helpful?

Solution

You don't. Your detail view should be a generic, reusable object, that is passed the specific core data object when you initialise it.

When you select the cell, you will have its index path. The index path can be used to get the managed object, which is then passed to your detail view.

The detail view(controller) then makes any amendments to the passed in object.

This is covered in any master-detail tutorial you would find.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top