1.strong:强指针/强引用weak:弱指针/弱引用2.默认情况下,任何指针都是强指针3.使用__weak修饰的指针为弱指针4.Person *p = [[Person alloc] init];[[Person alloc] init],系统会分配内存装这个对象,然后交给p这个指针去指着。5....
分类:
其他好文 时间:
2015-08-19 20:18:45
阅读次数:
244
PS:其实这一篇和上一篇很类似,都是为了解决内存不足(OOM)这种情况的发生...学习内容:1.对象的引用类.... 最近也是通过项目中知道了一些东西,涉及到了对象的引用类,对象的引用类分为多种,强引用(其实就是正常的引用),使用SoftReference实现软引用,Weak Reference(弱...
分类:
移动开发 时间:
2015-08-19 20:18:32
阅读次数:
128
UIPickerView#import "ViewController.h"@interface ViewController ()@property (nonatomic,strong)NSArray *foods;@property (weak, nonatomic) IBOutlet UILa...
分类:
移动开发 时间:
2015-08-19 16:09:24
阅读次数:
121
#import "ViewController.h"@interface ViewController ()@property (weak,nonatomic) IBOutlet UIImageView *tupianView;@end@implementation ViewController-(...
分类:
移动开发 时间:
2015-08-18 16:15:10
阅读次数:
142
#import "ViewController.h"#import "DrawView.h"@interface ViewController ()@property (weak, nonatomic) IBOutlet UIImageView *imageView;- (IBAction)doTo...
分类:
移动开发 时间:
2015-08-18 14:03:16
阅读次数:
209
感觉不错的代码。收藏下。
#import "GDBookTableViewCell.h"
#import "GDBook.h"
@interface GDBookTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconLabel;
@property (weak, nonatomic) IBOutlet U...
分类:
移动开发 时间:
2015-08-18 11:53:01
阅读次数:
141
对于初学的开发者,对于assign、retain、copy、strong、weak的用法及意义可能不是很明白,我对于这个问题也研究了很久,在篇博文,巧巧代码,让我们来瞧瞧吧!
先定义一个Student类:
#import
@interface Student : NSObject
@property (nonatomic, copy) NSString *name;
@end
然后先是mrc...
分类:
移动开发 时间:
2015-08-16 00:38:47
阅读次数:
268
在开发中我们经常使用代理,或自己写个代理,而代理属性都用weak(assign)修饰,看过有些开发者用strong(retain),但并没发现有何不妥,也不清楚weak(assign)与strong(retain)修饰有何区别功能实现就行了,考虑这么多干嘛~~~我只能哈哈哈
weak:指明该对象并不负责保持delegate这个对象,delegate这个对象的销毁由外部控制
@property (no...
分类:
移动开发 时间:
2015-08-15 10:23:44
阅读次数:
158
WEAK_SELF(vc);
[self.tableView addLegendFooterWithRefreshingBlock:^{
vc.pageIndex++;
[vc httpRequestWithPageIndex:vc.pageIndex];
}];
[s...
分类:
移动开发 时间:
2015-08-12 09:02:46
阅读次数:
352
1042. Shuffling Machine (20)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak...
分类:
系统相关 时间:
2015-08-11 15:52:48
阅读次数:
164