co oznacza kopia własności w strukturze Cocoa? (jak własność przedmiotów UITabBar)
W UITabBar.h, proroczo podpisana kopia
@ właściwość (nonatomic, copy) NSArray * przedmioty; // pobierz / ustaw widoczne
To tablica A co oznacza „kopia”? skopiuj kontener NSArray obj? skopiuj każdy obj NSArray? lub coś.
więc jest testUITabBar* testBar = [[UITabBar alloc] init];
UITabBarItem* item = [[UITabBarItem alloc] init];
NSArray* array = [[NSArray alloc] initWithObjects:item, nil];
NSLog(@"bar:%p,%d", testBar, testBar.retainCount);
NSLog(@"item:%p,%d", item, item.retainCount);
NSLog(@"array:%p,%d", array, array.retainCount);
testBar.items = array;
NSLog(@"that item:%p,%d", [testBar.items lastObject], [[testBar.items lastObject] retainCount]);
NSLog(@"testBar.items:%p,%d", testBar.items, testBar.items.retainCount);
wynikpasek: 0x96a9750,1
element: 0x96aa230,2
tablica: 0x96aa280,1
ten element: 0x96aa230,2
testBar.items: 0x96aa280,6
dlaczego ani tablica kontenerów, ani obj w tablicy nie została „skopiowana”?