在Core Data項目中,我的界面(表格)上有兩個按鈕,一個用於編輯關於某人的數據並將其保存到數據庫中,另一個用於讓您直觀地瀏覽數據而不實際保存它的數據庫。 如何「分離」核心數據對象,以便它不會將數據寫入數據庫?我試圖編寫一個模仿NSManagedObject類的新NSObject類,然後將數據移入NSObject類,但它仍然會更改數據庫!如何從Core Data中分離管理對象?
//button for editing and saving
PersonObj *person = (PersonObj *)[fetchedResultsController objectAtIndexPath:indexPath];
PersonEditViewController *editViewController = [[PersonEditViewController alloc] initWithStyle:UITableViewStyleGrouped];
// puts the managed object into the new view controller
editViewController.person = person;
[self.viewController pushViewController:editViewController animated:animated];
[editViewController release];
//button for editing and NOT saving
PersonObj *person = (PersonObj *)[fetchedResultsController objectAtIndexPath:indexPath];
PersonFiddlingViewController *fiddling = [[PersonFiddlingViewController alloc] initWithStyle:UITableViewStyleGrouped];
// move db data into non-db class??? not working
fiddling.eyeColor = person.eyeColor;
fiddling.name = person.name;
[self.viewController pushViewController:fiddling animated:animated];
[fiddling release];