我正在使用 NSMutableArray 填充表格视图中的单元格。问题是,当我尝试将一个对象添加到我的数组时,它会将所有对象替换为添加的对象,因此我的数组中始终只有 1 个对象。因此,每当调用以下方法时,我的 tableview 总是有一个单元格被覆盖。我错过了什么吗?
_selectedThingArray = [[NSMutableArray alloc] init];
_currentThing = newThing;
//Note: newThing is the object being passed when this method is called.
//It is the new data that will should passed into the cell.
[_selectedThingArray addObject:_currentThing];
NSLog(@"%@", newThing);
NSLog(@"array: %@", _selectedThingArray);
[self.tableView reloadData];