ios - Does adding a NSMutableDictionary to a NSMutableDictionary make a copy or does it keep a pointer -
does adding nsmutabledictionary nsmutabledictionary make copy or keep pointer.
i want able update content of first nsmutabledictionary , have tracked within other nsmutabledictionary - example...
nsmutabledictionary* dicta = [[nsmutabledictionary alloc] init]; nsmutabledictionary* dictb = [[nsmutabledictionary alloc] init]; [dicta setvalue:[nsnumber numberwithint:1 ] forkey:@"number"]; [dictb setvalue:dicta forkey:@"dicta"]; [dicta setvalue:[nsnumber numberwithint:2 ] forkey:@"number"];
will dictb.dicta.number = 2?
yes, will. in general, cocoa collection classes retain objects added them (the purpose: way can insert non-copyable objects too).
(with corefoundation trickery , toll-free bridging, possible realize nsarray
copies elements, though.)
Comments
Post a Comment