0

NSString *cel=@"文本"; NSIndexPath *a = [NSIndexPath indexPathForRow:1 inSection:1]; CustomCell *c = (CustomCell *)[tableView cellForRowAtIndexPath:a]; c.yes.text = cel; 我正在使用这些行来更新放置在 tablecell 上的 UITextfield .....但它给了我一些像这样的错误

RootViewController.m:110: error: 'tableView' undeclared (首先在这个函数中使用)

4

1 回答 1

0

编译器告诉你 tableView 在调用函数的执行范围内是未知的。如果您在界面生成器中添加了 UITableView,那么您需要在 RootViewController 的类定义中添加一个,如下所示:

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

IBOutlet UITableView *tableView;

...
@end

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

然后在你添加的实现中

@synthesize tableView;

在 Interface Builder 中,通过右键单击(或控制单击)表视图并将该行拖到显示窗口中的 RootViewController 行并从弹出的灰色窗口中选择 tableView,将您创建的表视图链接到此 tableView 变量。

于 2010-10-16T13:01:56.660 回答