更新表格单元格中的文本字段

发布于 2024-09-27 09:32:53 字数 338 浏览 0 评论 0原文

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

RootViewController.m:110: error: 'tableView' undeclared (first use in this function)

NSString *cel=@"text";
NSIndexPath *a = [NSIndexPath indexPathForRow:1 inSection:1];
CustomCell *c = (CustomCell *)[tableView cellForRowAtIndexPath:a];
c.yes.text = cel;
I am using these line for updating the UITextfield placed on the tablecell .....
but it giving me some error like this

RootViewController.m:110: error: 'tableView' undeclared (first use in this function)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半衬遮猫 2024-10-04 09:32:53

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

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

IBOutlet UITableView *tableView;

...
@end

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

然后在实现中添加

@synthesize tableView;

在界面生成器中通过右键单击将您创建的表视图链接到此 tableView 变量(或者控制点击表格视图并将该线拖至显示窗口中的 RootViewController 线,并从弹出的灰色窗口中选择 tableView。

The compiler is telling you that tableView is unknown within the scope of execution of the calling function. If you have added a UITableView in interface builder then you need to add one to your class definition of RootViewController also like so:

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

IBOutlet UITableView *tableView;

...
@end

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

and then in the implementation you add

@synthesize tableView;

In Interface Builder link the table view you have created to this tableView variable by right clicking (or control clicking) on the table view and dragging the line to the RootViewController line in the display window and select tableView from the pop up gray window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文