ARC下 定義數組
NSMutableArray *tt和NSMUtableArray *tb
當NSMUtableArray *tb=[[NSMutableArray alloc] init];
NSDictionary *d=[NSDictionary dictionaryWithObject:@"123" forKey:@"11"];
for (int i=0; i<10; i++) {
[tb addObject:d];
}
到這一步tb裏面有十個字典數據。
然後如果
tt=tb;這一步tt裏面也有10個字典數據。(注意了:這裏tt其實有點類似於c語言裏面指針指向的tb的);
當[tb removeAllObjects];後會發現 tt裏面也空了。
所以數組賦值要tt=[tb copy];才行。