摘要: 1、基本理论alloc new (mutable)copy 这三者会使计数器+1retain 返回其调用的对象本身示例:Person * p = [[Person alloc] init]; // retainCount 为1 ,p是在栈内存中,其内保存着指向堆内存中开创出来的Person对象地址的值。[p retain]; // 返回p本身,即可以写成 p = [p retain] 此时retainCount 为2[p release]; // 计数器减1 retainCount 为1[p release]; // 计数器再减1 retainCount 为0 ,将自动调用person对象的. 阅读全文
posted @ 2014-03-08 16:55 ProgrammerZHANG 阅读(376) 评论(0) 推荐(0) 编辑