码迷,mamicode.com
首页 >  
搜索关键字:retain cycle    ( 2217个结果
(转)IOS内存管理 retain release
obj-c本质就是"改进过的c语言",大家都知道c语言是没有垃圾回收(GC)机制的(注:虽然obj-c2.0后来增加了GC功能,但是在iphone上不能用,因此对于iOS平台的程序员来讲,这个几乎没啥用),所以在obj-c中写程序时,对于资源的释放得由开发人员手动处理,相对要费心一些。引用计数这是一...
分类:移动开发   时间:2015-03-17 21:29:50    阅读次数:185
细数AutoLayout以来UIView和UIViewController新增的相关API
UILayoutSupport1 @property(nonatomic,readonly,retain) id topLayoutGuide NS_AVAILABLE_IOS(7_0); 2 @property(nonatomic,readonly,retain) id bottomLayout....
分类:Windows程序   时间:2015-03-17 10:23:42    阅读次数:239
UIButton
UIButton有很多种状态,它提供了一些便捷属性,可以直接获取当前状态下的文字、文字颜色、图片等@property(nonatomic,readonly,retain) NSString *currentTitle;@property(nonatomic,readonly,retain) UICo...
分类:其他好文   时间:2015-03-16 22:56:44    阅读次数:160
单例-Singleton-03
在非ARC中设计单例模式// 在非ARC中,需要重写下面三个方法,这样比较安全- (oneway void)release{ }- (id)retain{ return self;}- (NSUInteger)retainCount{ return 1;}
分类:其他好文   时间:2015-03-16 19:10:16    阅读次数:112
iOS strong,copy,retain,weak,assign的区别,以及各自的用法
1:ARC环境下,strong代替retain.weak代替assign 2:weak的作用:在ARC环境下,所有指向这个对象的weak指针都将被置为nil。这个T特性很有用,相信很多开发者都被指针指向已释放的对象所造成的EXC_BAD_ACCESS困扰过,使用ARC以后,不论是strong还是weak类型的指针,都不会再指向一个已经销毁的对象,从根本上解决了意外释放导致的crash。 3:a...
分类:移动开发   时间:2015-03-16 16:35:13    阅读次数:174
Linked List Cycle II
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?思路:...
分类:其他好文   时间:2015-03-16 12:38:20    阅读次数:95
Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:1.两个指针,一个走1步,一个走2步,如果相遇则有环注意: 在使用p->nex...
分类:其他好文   时间:2015-03-15 19:38:56    阅读次数:126
Linked List Cycle
/* 开始用hash做的,但这明显不是最优的*//** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : v...
分类:其他好文   时间:2015-03-15 15:11:29    阅读次数:93
HDU 1005
此题关键是要发现周期性。#include #include int f[1000];int compute(int a, int b, int n){ int i, cycle; memset(f, 0, 1000*sizeof(int)); f[1] = 1; f[...
分类:其他好文   时间:2015-03-13 20:29:01    阅读次数:138
Linked List Cycle
Given a linked list, determine if it has a cycle in it.简单题,只要知道快慢指针这个技巧就很容易解了。 1 class Solution { 2 public: 3 bool hasCycle(ListNode *head) { 4 ...
分类:其他好文   时间:2015-03-13 01:38:17    阅读次数:110
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!