1. --------
ViewController : init with nib
* (internal) load nib
* (internal) init controller/view in nib
View : awakeFromNib
Controller : awakeFromNib ( if nib contain ViewController )
Controller : ViewDidLoad
Controller : ViewWillDisappear ------ 這部份很重要
Controller : dealloc
Controller : ViewDidUnload
if @property defined "retain", then any setXXX interface will increase reference count
這個東西很重要
2. -------- Category
語法:
@interface some_existed_class (my_extension)
@implement some_existed_class (my_extension)
This will "extends" some existing class to my usage
Without needing source code.
Categories 在建立 private methods 時十分有用。因為 Objective-C 並沒有像 Java 這種 private/protected/public methods 的概念,所以必須要使用 categories 來達成這種功能。作法是把 private method 從你的 class header (.h) 檔案移到 implementation (.m) 檔案。以下是此種作法一個簡短的範例。
沒有留言:
張貼留言