I have application with following design: Table View that lists documents. And ViewController where document is edited.
When editing the document I want to use a copy of object so in case user press Cancel I just throw away the copy. If user selected Save I copy modified document to original. (I can't have all document's fields as properties in viewController because there are too many of them).
Table View controller:
SelectedRowAtIndex {
document= [documentsArray objectAtIndex:indexPath.row];
viewController.assignedDocuemnt= document;
}
Then I have View controller class where the item is modified:
@interface
@property (nonatomic,retain) Document *asignedDocument;
@property (nonatomic,retain) Document *editedDocument;
viewDidLoad{
editedDocument= [assignedDocuemnt copy];
}
IBAction save {
assignedDocument=editedDocument;
}
My problem is that original document in documentsArray is not updated with edited version. What did I miss?