[閒聊] UICotrol variable的命名

作者: whitefur (白毛)   2015-05-31 19:17:24
UIControl變數命名有什麼建議的方式嗎
例如
UIButton *addButton
UIView *filterView
在最後面加上class的名常還蠻常見的
我自己也是這樣命名
但是像tableView跟collectionView的話大家也這樣命名嗎?
UICollectionView *backgroundPickerCollectionView
UITableView *photoListTableView
作者: darktt (小朱)   2015-05-31 19:21:00
只要是view的就是View結尾,viewController的就Controller結尾不過常常看到繼承UIViewController的給我用View結尾我自己還有一個特例,就是UITableViewCell或UICollectionViewCell的會用Cell結尾就是了
作者: neotek   2015-05-31 19:38:00
一個Controller裡面只有一個table或collection的話我都直接用tableView 或是 collectionView才不用每次切換到不同controller都要找一下這邊叫什麼名字
作者: BS0824 (Bright_Sky)   2015-05-31 22:16:00
如果ViewController前面名稱太長,我會簡稱OOOOOVC比較好記
作者: jfang   2015-06-07 18:19:00
雖然Objective-C本身就習慣長命名,但以ViewController來說我也習慣用VC當作結尾

Links booklink

Contact Us: admin [ a t ] ucptt.com