NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:@"1"];
NSString *test = array[0];
test = @"2";
NSLog(@"%@", array[0]); //Output is 1
array[0] = @"2";
NSLog(@"%@", array[0]); //Output is 2
Whats going on ? Why in first case output is 1 ? Doesn't NSMutableArrat keeps links to an objects ?
Aucun commentaire:
Enregistrer un commentaire