내 응용 프로그램에서는 NSUserDefaults에 저장하는 데이터의 개체 클래스를 많이 만들었습니다. 뷰 컨트롤러에서개체의 로컬 인스턴스를 편집하면 주 배열의 개체가 변경됩니다.
LauncherEditActionViewController *editActions = [[LauncherEditActionViewController alloc] initWithToDoItem:item];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:editActions];
[self presentViewController:navController animated:YES completion:nil];
내가 편집 버전에서 데이터를 표시하는 테이블이 : 그럼 내가이 편집 뷰 컨트롤러에게 전달
LauncherToDoItem *item = [[ActionHelper sharedInstance] actionList][indexPath.row];
:
나는하여 아이템을 얻을 항목의
- (id)initWithToDoItem:(LauncherToDoItem *)toDoItem {
self=[super initWithStyle:UITableViewStyleGrouped];
if (self) {
item = toDoItem;
editedToDoItem = toDoItem;
}
return self;
}
나는 그것이 또한 항목을 기록하는 editedToDoItem
을 편집, 그래서 그것은 또한 배열의 버전으로 쓰고 같은데요? 왜 그것들 중 하나를 편집하면 그것 모두에 영향을 미치는가? 배열에 다시 저장하지는 않지만 값은 자동으로 저장됩니다.