2011年10月25日 星期二

Backup all installed packages and move to another computer

Backup installed package list on current machine
dpkg --get-selections > selections.txt

move selections.txt to the new machine Set package list on new machine and install packages
dpkg --set-selections < selections.txt
apt-get update
apt-get upgrade

2011年10月12日 星期三

viewWillDisappear

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) 檔案。以下是此種作法一個簡短的範例。

2011年10月11日 星期二

iPhone development add button action

iOS set action

1. define IBAction functions in controller
2. Add buttons in xib
3. In file's owner's connection inspector, match each action function with each button. This part is critical, without it, the button press will do nothing.