本文主要是介绍IOS 5 ARC完全指南,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ARC完全指南iOS 5最显著的变化就是增加了Automatic Reference Counting(自动引用计数)。ARC是新LLVM 3.0编译器的特性,完全消除了手动内存管理的烦琐。在你的项目中使用ARC是非常简单的,所有的编程都和以前一样,除了你不再调用retain, release, autorelease。启用ARC之后,编译器会自动在适当的地方插入适当的retain, release, autorelease语句。你不再需要担心内存管理,因为编译器为你处理了一切。注意ARC是编译器特性,而不是iOS运行时特性(除了weak指针系统),它也不是其它语言中的垃圾收集器。因此ARC和手动内存管理性能是一样的,有些时候还能更加快速,因为编译器还可以执行某些优化。
具体内容太多,就不列了,这里列个目录:
ARC完全指南 ................................................................................................................ 3
指针保持对象的生命............................................................................................. 3
Xcode的ARC自动迁移 ......................................................................................... 9
Xcode的自动迁移工具 ................................................................................... 9
转换后的其它问题........................................................................................ 14
禁止某些文件的ARC .................................................................................... 14
ARC自动迁移的常见问题 ............................................................................ 15
属性property ....................................................................................................... 17
IBOutlet .......................................................................................................... 18
readonly property .......................................................................................... 19
autorelease、release、retain调用 ..................................................................... 19
dealloc方法 .......................................................................................................... 20
AutoreleasePool .................................................................................................... 20
Toll-Free Bridging .................................................................................................. 21
Delegate 和 Weak Property ................................................................................ 26
unsafe_unretained ................................................................................................ 27
iOS 4中使用ARC .................................................................................................. 27
ARC高级指南 .............................................................................................................. 28
Blocks与ARC ........................................................................................................ 28
Singleton与ARC ................................................................................................... 34
Autorelease和AutoreleasePool .......................................................................... 40
Cocos2D 和 Box2D .............................................................................................. 45
静态库static library .............................................................................................. 48
最后?................................................................................................................... 49
参考资料............................................................................................................... 49
下载:http://www.cocoachina.com/bbs/read.php?tid=92507&page=1
这篇关于IOS 5 ARC完全指南的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!