开发者

NSMutableArray initialization methods

开发者 https://www.devze.com 2023-02-14 20:27 出处:网络
Is there a difference betwe开发者_Go百科en [NSMutableArray array] and [[NSMutableArray alloc] init] ?[[NSMutableArray alloc] init] returns a mutable array that you own (and therefore have to explicitl

Is there a difference betwe开发者_Go百科en [NSMutableArray array] and [[NSMutableArray alloc] init] ?


[[NSMutableArray alloc] init] returns a mutable array that you own (and therefore have to explicitly relinquish ownership using release when you no longer need it) and [NSMutableArray array] returns a mutable array that you don't own.

According to the Memory Management Rules, any method with the word alloc, new, or create in the name, implies that you own the object returned from that method.

0

精彩评论

暂无评论...
验证码 换一张
取 消