NSArray内にNSDictionariesがいくつかあります。私は、配列全体がその変更(テーブルビューを読み込む)を持つように、辞書の中のBOOLを修正したい。辞書の更新キー
私はこのコードを持っていますが、BOOLは変更されません。あなたは、オブジェクトの変更可能なコピーを作成する場合、それは正確に、コピーできるでしょう
NSLog(@"before: %@", self.currentScopeArray);
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[[self.currentScopeArray objectAtIndex:iIndexPath.row] setObject:[NSNumber numberWithBool:YES] forKey:@"enabledByDefault"];
} else {
if (!(self.currentScopeArray.count < 2)) {
cell.accessoryType = UITableViewCellAccessoryNone;
[[[self.currentScopeArray objectAtIndex:iIndexPath.row]mutableCopy] setObject:[NSNumber numberWithBool:NO] forKey:@"enabledByDefault"];
}
}
NSLog(@"after: %@", self.currentScopeArray);
その行から 'mutableCopy'を削除しましたが、他に何が必要ですか?私がしていることがあれば、アプリはクラッシュします。 – Jon
その配列の辞書は 'NSMutableDictionary'sである必要があります。どのようにして最初にアレイを作成していますか? – mattjgalloway