ios學習筆記

1.對於autorelease的理解ios

  Each thread in a Cocoa application maintains its own stack of autorelease pool blocks.(Advanced Memory Management Programming Guide:Using Autorelease Pool Blocks)objective-c

     經過這句話,咱們能夠看出架構

  • autorelease pool 是棧的形式,and autorelease pool blocks can be nested
  • 主線程中也有本身的autorelease pool,這又牽扯出run loop。實際上,每次執行一次runloop時,就會釋放當前autorelease pool中的對象。run loop 是ios中與線程有關的一個基礎架構,用於處理事件循環的。

 

2.對於runtime的理解app

  The objective-c language defers as many decisions as it can from compile time and link time to runtime.ide

    這意味着oc不只須要一個編譯器,還須要一個運行時系統,來執行編譯過的代碼。這個運行時系統對於oc來講扮演着操做系統的角色。oop

  • In Objective-C, messages aren't bound to method implentationss until runtime.

 

3.對於CALayer的理解ui

  Layer是Core Animation的核心。spa

  Layers are data objects that manage content provided by your app。操作系統

  A layer's content contains of a bitmap containing the visual data you want to display.有3種方法來設置它的content線程

  • 直接將一個對象分配給layer的content屬性
  • 爲layer指定個delegate對象,來delegate來draw它的content:displayLayer: 和drawLayer: inContent:
  • 子類一個layer,重寫它的drawing方法:重寫display或者drawInContext方法
相關文章
相關標籤/搜索