2010-10-16 39 views
0

NSString * cel = @「text」; NSIndexPath * a = [NSIndexPath indexPathForRow:1 inSection:1]; CustomCell * c =(CustomCell *)[tableView cellForRowAtIndexPath:a]; c.yes.text = cel; 我使用這些線更新的UITextField置於TableCell的..... 但它給我一些錯誤這樣更新表格中的textfield

RootViewController.m:110:錯誤:「的tableView」未申報(第一次在這個函數中使用)

+0

你能清理上述問題,使其更具可讀性嗎? – twerdster 2010-10-16 12:45:23

回答

0

編譯器告訴你tableView在執行調用函數的範圍內是未知的。如果您已經添加在Interface Builder一個UITableView,那麼你需要添加一個到RootViewController的的類定義也很喜歡這樣:

@interface RootViewController:UIViewController< UITableViewDelegate, UITableViewDataSource> 
... 

IBOutlet UITableView *tableView; 

... 
@end 

@property (nonatomic,retain) IBOutlet UITableView *tableView; 

,然後在執行添加

@synthesize tableView; 

在Interface Builder鏈接通過在表視圖上右鍵單擊(或控制單擊)並將該行拖到顯示窗口中的RootViewController行並從彈出的灰色窗口中選擇tableView,爲此tableView變量創建的表視圖。