IOS 5 ARC完全指南

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.