I'm wondering what the best practice is to modify information that is passed to a detail view controller from a table view controller.
Basically the way I have this set up is a table view controller gets a list of data objects from the data controller, which it uses to populate it's table cells. Then when a user clicks on a cell the controller pushes a detail view controller with one of the data objects.
So now the detail view controller has (I believe) an instance of one of the data objects. One of the properties of that object is an NSMutableArray. I want to be able to add/modify elements in that array.
Currently I have the detail view controller set up to send addObject:element to it's data object's Array...but that's not working. Basically the element get's "added", but if I go back to the table view, and then click on the detail view again, it crashes. I believe that is because the actual object contained by the TableViewController is not being updated.
So, here's the question:
Do I need to:
1) Use the DataController to implement some method to update the object that the TableViewController's object...rather than update the object that the DetailViewController's object directly?
or
2) Am I forgetting a step that I need to do to update the information contained in the TableViewController in some other way?
Thanks
Basically the way I have this set up is a table view controller gets a list of data objects from the data controller, which it uses to populate it's table cells. Then when a user clicks on a cell the controller pushes a detail view controller with one of the data objects.
So now the detail view controller has (I believe) an instance of one of the data objects. One of the properties of that object is an NSMutableArray. I want to be able to add/modify elements in that array.
Currently I have the detail view controller set up to send addObject:element to it's data object's Array...but that's not working. Basically the element get's "added", but if I go back to the table view, and then click on the detail view again, it crashes. I believe that is because the actual object contained by the TableViewController is not being updated.
So, here's the question:
Do I need to:
1) Use the DataController to implement some method to update the object that the TableViewController's object...rather than update the object that the DetailViewController's object directly?
or
2) Am I forgetting a step that I need to do to update the information contained in the TableViewController in some other way?
Thanks