我想要在NSMutableArray
替換一個數組對象,從_alertsArray
獲取了oldArray
,然後修改值,用newArray
替換oldArray
,但是沒實現。
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];
NSMutableArray *newArray = [_alertsArray mutableCopy];
[newArray replaceObjectAtIndex:3 withObject:@"YES"];
_alertsArray = newArray;