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