简体   繁体   English

(iPhone)nsarray,nsmutablearray保留/释放

[英](iphone) nsarray, nsmutablearray retain/release

this is so basic, but quite not sure how to release array object in object-c. 这是很基本的,但是还不确定如何在object-c中释放数组对象。

I know that adding an object to array retains the object. 我知道将对象添加到数组会保留该对象。
and removing it from an array releases the object. 并将其从数组中删除会释放该对象。

When I have an array(mutable or not), 当我有一个数组(可变或不可变)时,
does 'releasing the array itself' also removes objects inside the array(therefore sending release to each object)? “释放数组本身”是否还会删除数组中的对象(因此将释放发送到每个对象)?
Or should I remove the object first and release the array to reverse the operation (which is retaining array and each object in it). 或者我应该首先删除对象并释放阵列的扭转操作(其被保持阵列和它的每个对象)。

Thank you 谢谢

NSArrayNSMutableArray实例上调用release也会释放其对象,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM