2011年8月27日 星期六

iPhone ObjC 的一些小用法

-----------------------------------------------------------------
一些 iPhone ObjC 的語法
因為用 C 用習慣了, 所以很需要 "formatter"
-----------------------------------------------------------------
[NSString stringWithFormat:@"%@ (%@)", [nameComponents objectAtIndex:2], [nameComponents objectAtIndex:1]];
-----------------------------------------------------------------
在 Table 裡面, 產生
+/- Item-Context >
這樣的效果的方式
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator :可以放 ">" 在 table cell 的右邊
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath : 可以放 +/- 在 table cell 的左邊
-----------------------------------------------------------------
在加入 code data 的時候, 不要勾選 copy file/folder 的選項, 會造成 link fail
-----------------------------------------------------------------
在 obj c 裡面, 有一個隱含的語法, 當我們在 class 裡面有一個 attribute, 比如說, TypeA AttrA; 用 proprety 去宣告.
同時 implement 了一個 TypeA AttrA { .... } 的函數, 則在 reference 到 AttrA 的時後, 會主動連結到這個函數.

沒有留言: