//1、数据源用可变字典存储(需要alloc)
//2、先把(获取到的(需要修改成的))数据变成可变的
dict = @{@"content":[htmlContent stringByReplacingOccurrencesOfString:@"\"" withString:@"'”],
@"id":mutArray[section][@"id”],
@"image":mutArray[section][@"image"]};
NSMutableDictionary *mutNewDict = [NSMutableDictionary dictionaryWithDictionary:dict];
//3、再获取到数据源中需要被修改的数据,并变成可变的
NSMutableDictionary *mutSourceDict = [NSMutableDictionary dictionaryWithDictionary:mutArray[section]];
//4、按照原格式,重新设置需要被修改的数据
[mutSourceDict setDictionary:mutNewDict];
//5、获取到数据源数组,并变成可变的
NSMutableArray *mutSourceArr = [NSMutableArray arrayWithArray:mutArray];
//6、删除数据源中需要被修改的数据
[mutSourceArr removeObjectAtIndex:section];
//7、插入新数据
[mutSourceArr insertObject:mutSourceDict atIndex:section];
//8、按照原格式,重新设置数据源数组
[mutDict setObject:mutSourceArr forKey:@"list”];
网友评论