编辑:您不太了解对象引用的工作原理。当您从数组或其他“保留”它的对象中请求一个对象时,您并没有创建一个新对象。因此,您最终不会得到“以前的对象”和“更新的对象”。考虑一下:
NSMutableDictionary *dict = [array objectAtIndex:index];
[dict setObject:@"Hello" forKey:@"Status"];
//You don't need to add *dict back to the array in place of the "old" one
//because you have been only modifying one object in the first place
[array replaceObjectAtIndex:index withObject:dict]; //this doesn't do anything
考虑到...
你这样做的方式是倒退的。在您的 UITableVieCell 子类中为您的数组创建一个属性
interface CustomCell : UITableViewCell
@property (nonatomic,retain) NSMutableArray *vcArray;
@end
#import CustomCell.h
@implementation CustomCell
@synthesize vcArray;
-(IBAction)setStateOfObjects {
NSMutableDictionary *dictionary = [parseTrackArrayToBeModified objectAtIndex:currentIndex];
[dictionary setObject:[NSNumber numberWithBool:YES] forKey:@"sliderEnabled"];
//THIS LINE IS REDUNDANT
//[parseTrackArrayToBeModified replaceObjectAtIndex:currentIndex withObject:dictionary];
//END REDUNDANT LINE
}
//in your ViewController's delegate method to create the cell
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//assume previous code has CustomCell created and stored in variable
CustomCell *cell;
cell.vcArray = self.parseTrackArray;
return cell;
}