__weak typeof(self) weakSelf = self的应用意思是声明了一个self类型的weakSelf,加上__weak表示它是弱引用的。整行代码就是给self定义了一个弱引用性质的替身。一般用在block上,因为block会copy它内部的变量,可能会造成循环引用,使用__we...
分类:
其他好文 时间:
2015-09-01 16:33:25
阅读次数:
209
参考文献:iOS ARC 完全指南提示:本文中所说的"实例变量"即是"成员变量","局部变量"即是"本地变量"一、简介ARC是自iOS 5之后增加的新特性,完全消除了手动管理内存的烦琐,编译器会自动在适当的地方插入适当的retain、release、autorelease语句。你不再需要担心内存管理...
分类:
其他好文 时间:
2015-09-01 12:33:56
阅读次数:
208
1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @property(nonatomic,weak) IBOutlet UIImageView* imageView; 6 7 @end 8 ...
分类:
Web程序 时间:
2015-08-31 23:17:47
阅读次数:
222
NSlog(@"Retain count is %ld", CFGetRetainCount((__bridge CFTypeRef)self));block保环流--->>__weak typeof(AA) bb = AA__unsafe_unretained typeof(AA) bb =AA
分类:
其他好文 时间:
2015-08-31 14:49:20
阅读次数:
138
现象使用firefox访问一些网站时会遇到如下错误:
在服务器密钥交换握手信息中 SSL 收到了一个弱临时 Diffie-Hellman 密钥。 (错误码: ssl_error_weak_server_ephemeral_dh_key)解决办法在firefox上安装disable dhe插件
下载地址:https://addons.mozilla.org/en-us/firefox/addon/...
分类:
其他好文 时间:
2015-08-31 11:53:41
阅读次数:
170
Blocks是Objective-C的匿名函数。block是iOS在4.0之后新增的程序语法。
Blocks有三种类型,_NSConcreteGlobalBlock,_NSConcreteStackBlock和_NSConcreteMallocBlock。
1._NSConcreteGlobalBlock 全部的静态block,不会访问任何外部变量。
2._NSConcreteStackBl...
分类:
其他好文 时间:
2015-08-30 21:21:54
阅读次数:
169
1.我们常常使用nonatomic,很多人只知道它的效率较高,却不知道其含义,其含义是非线程安全的,也就是说多线程修改时不加锁,可能出现多个线程先后修改而成为脏数据的情况。
2.unsafe_unretained和assign的作用是一致的,如果对象数据也采用这种方式,这个property就只是指向数据的指针而已,这样说来,似乎assign和weak是一样的,但他们有个很大的区别,在下一条中说明...
分类:
移动开发 时间:
2015-08-30 21:21:26
阅读次数:
158
Your code will work fine: the weak reference will not cause a retain cycle as you explicitly instruct ARC not to increase the retainCount of your weak...
分类:
其他好文 时间:
2015-08-30 17:11:47
阅读次数:
185
Model cell#import
@interface ImageCell : UICollectionViewCell
@property (nonatomic, copy) NSString *image;
@end
#import "ImageCell.h"@interface ImageCell()
@property (weak, nonatomic) I...
分类:
移动开发 时间:
2015-08-30 10:00:18
阅读次数:
441
Model cell@interface ImageCell : UICollectionViewCell
@property (nonatomic, copy) NSString *image;
@end
@interface ImageCell()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end@implemen...
分类:
移动开发 时间:
2015-08-30 09:59:52
阅读次数:
251