我想替换NSMutableArray
对象中的数组对象。
我从oldArray
获取_alertsArray
并更改其值,并希望将oldArray
替换为newArray
。但是没有效果!!
NSArray *oldArray = (NSArray *)[_alertsArray objectAtIndex:[indexPath row]];
NSMutableArray *newArray = [[NSMutableArray alloc] initWithArray:oldArray copyItems:YES];
[newArray replaceObjectAtIndex:3 withObject:@"YES"];
[_alertsArray replaceObjectAtIndex:[indexPath row] withObject:newArray];
答案 0 :(得分:0)
NSMutableArray *newArray = [_alertsArray mutableCopy];
[newArray replaceObjectAtIndex:3 withObject:@"YES"];
_alertsArray = newArray;