ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting)。简单地说,就是代码中自动加入了retain/release,原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成了。该机能在 iOS 5/ Mac OS X 10.7 开始...
分类:
其他好文 时间:
2015-11-03 09:17:22
阅读次数:
247
---恢复内容开始---MRC: Manul(手动) Reference(引用) Counting(计数)什么是手动引用计数?所有对象的内容都需要我们手动管理, 需要程序员自己编写release/retain等代码内存管理的原则就是有加就有减也就是说, 一次alloc/new/copy对应一次rel...
分类:
其他好文 时间:
2015-11-03 00:45:49
阅读次数:
304
assign vs weak, __block vs __weak字数364 阅读74 评论0 喜欢0 在objective-c中,类中的全局变量经常使用如下的方式申明。@property(nonatomic(1),strong(2))UIImageView *imageView;其中的1,2处是对...
分类:
其他好文 时间:
2015-11-02 19:18:49
阅读次数:
278
ARC是什么ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting)。简单地说,就是代码中自动加入了retain/release,原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成了。该机能在 iOS 5/ Mac OS X 1...
分类:
其他好文 时间:
2015-11-02 18:51:46
阅读次数:
231
在高级语言中,例如C#是通过垃圾回收机制(GC)来解决这个问题,但是在OC并没有类似的垃圾回收机制,因此必须由程序员手动去维护。今天就讲讲OC中的内存管理:一、内存管理原理在Xcode4.2之后的版本,由于引入了ARC(Automatic Reference Counting)机制,程序编译Xcod...
分类:
其他好文 时间:
2015-11-01 21:08:29
阅读次数:
224
the advantage of right value reference:Memory Optimizationsave memory copy
分类:
编程语言 时间:
2015-10-31 15:43:01
阅读次数:
174
#import "HMViewController.h"@interface HMViewController ()@property (weak, nonatomic) IBOutlet UIImageView *imageView;@end@implementation HMViewContro...
分类:
编程语言 时间:
2015-10-30 20:32:32
阅读次数:
190
Model cell@interface ImageCell : UICollectionViewCell@property (nonatomic, copy) NSString *image;@end@interface ImageCell()@property (weak, nonatomic)...
分类:
其他好文 时间:
2015-10-30 19:02:42
阅读次数:
285
__weak?__typeof(self)weakSelf??=?self;
分类:
其他好文 时间:
2015-10-30 15:43:41
阅读次数:
127
#import "EDRViewController.h"@interface EDRViewController ()@property(nonatomic,weak) UIWebView * webView;@end@implementation EDRViewController- (void...
分类:
移动开发 时间:
2015-10-30 15:25:51
阅读次数:
261