/* ARC的判断准则:只要没有强指针指向对象,就会释放对象 1.ARC特点 1> 不允许调用release、retain、retainCount 2> 允许重写dealloc,但是不允许调用[super dealloc] 3> @property的参数 * strong :成员变量是强指针(...
分类:
其他好文 时间:
2014-12-04 00:45:42
阅读次数:
187
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?使用双指针fast和slow,fast每次走两步,slow每次走一步,如果fast追...
分类:
其他好文 时间:
2014-12-03 23:04:47
阅读次数:
287
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?/**...
分类:
其他好文 时间:
2014-12-03 13:57:58
阅读次数:
163
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *...
分类:
其他好文 时间:
2014-12-03 13:54:01
阅读次数:
152
/* 1.方法的基本使用 1> retain :计数器+1,会返回对象本身 2> release :计数器-1,没有返回值 3> retainCount :获取当前的计数器 4> dealloc * 当一个对象要被回收的时候,就会调用 * 一定要调用[super dealloc],这句调用要放在.....
分类:
其他好文 时间:
2014-12-03 00:25:05
阅读次数:
150
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space?开始以为这道题只需要注意不使用额外空间即可,于是写了个时间复杂度为O(n^2)暴力...
分类:
其他好文 时间:
2014-12-02 14:56:30
阅读次数:
177
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up:Can you solve it without using extra space?这...
分类:
其他好文 时间:
2014-12-02 14:55:22
阅读次数:
195
内存管理,防止内存泄露如果a类引用某个那么内存块加1,如果a类不在引用了,内存块减一,当计数为0的时候,清空这个内存块。retain()函数void Ref::retain(){ CCASSERT(_referenceCount > 0, "reference count should gre...
分类:
其他好文 时间:
2014-12-02 13:25:51
阅读次数:
173
1 . 基本方法使用
1> retain : 计数器 + 1 , 会返回对象本身
2> release : 计数器 - 1 , 没有返回值
3> retainCount : 获取当前的计数器
4> dealloc
* 当一个对象要背回收的时候, 就会调用
* 一定要调用[super dealloc] , 这句调用要放在最后面
2.概念
1>僵尸对象 : 所占...
分类:
其他好文 时间:
2014-12-02 09:03:23
阅读次数:
151