看板 MacDev 關於我們 聯絡資訊
最近剛開始學iPhone程式設計 但在開發的時候卻遇到許多難題 像是都照範例打但程式卻編譯不出來(我和網路上的環境都是SDK3) 像這樣 http://img829.imageshack.us/img829/5598/macosxleopard2010072222.png
因為我有在表頭檔中使用<UITableViewDataSource> 所以numberOfRowInSection 和 cellForRowAtIndexPath都必須去實作 (這樣說不知道對不對^^) 但遺憾的是在嘗試輸入這兩個方法時 會找不到這個方法 (顯示No completions Found) http://img689.imageshack.us/img689/5598/macosxleopard2010072222.png
http://img708.imageshack.us/img708/5598/macosxleopard2010072222.png
所以程式就無法編譯成功了 但非常奇特的是把範例的程式碼貼到我的程式裡卻又可以WORK了(已檢查過都一模一樣) 研究了很久卻不知道為什麼這樣 請問各位高手有遇到類似的問題或是知道為什麼嗎? 謝謝 ////////程式資訊 .H檔 #import <UIKit/UIKit.h> @interface Simple_TableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { NSArray *listData; } @property (nonatomic, retain) NSArray *listData; @end .M檔 http://www.mgt.ncu.edu.tw/~inzaghi0507/123.rar 太多字用附檔^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.218.135
BlueKidds:請不要改參數的名字 照著protocol定的寫 07/23 00:15
inzaghi0507:不好意思請問參數是指? 07/23 00:54
我去查這裡 http://0rz.tw/c4ZPS tableView:numberOfRowsInSection: -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section tableView:cellForRowAtIndexPath: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath 都一模一樣欸 剛學搞不太清楚 請問參數是指這個嗎? ※ 編輯: inzaghi0507 來自: 140.115.218.135 (07/23 02:38)
aecho:剛開始我都是把查到的用法,copy & paste貼到.m裡面.... 07/23 06:11