从行内的文本字段中读取文本,以及如何在表View Row中找到按钮动作 [英] Read text from the textfield inside the row.And how can i find the button action inside the table View Row

查看:51
本文介绍了从行内的文本字段中读取文本,以及如何在表View Row中找到按钮动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在tableView的行和按钮内读取textField的文本,所以当用户单击该行的textfield数据集进入数据库时​​,

I want to read text of a textField inside the tableView Row And Button is also inside the so when user clicks that row textfield data set into database.

推荐答案

两种策略.

  1. 子类UITableViewCell,为您的textField添加一个属性.然后,在 -tableView:willSelectRowAtIndexPath:中,您可以调用UITableView的 -cellForRowAtIndexPath:来获取单元格.使用添加的属性访问UITextField.

  1. subclass UITableViewCell, add a property for your textField. Then in -tableView:willSelectRowAtIndexPath: you can call UITableView's -cellForRowAtIndexPath: to get the cell. Use the property you added to access the UITextField.

不要子类.当您将UITextField添加到UITableViewCell时,将其tag属性设置为某些唯一标识符.使用与上述相同的策略来获取UITableViewCell,然后使用UIView的 -viewWithTag:

Don't subclass. When you add the UITextField to the UITableViewCell set it's tag property to some unique identifier. Use the same tactic as above to get the UITableViewCell, but then get a pointer to the UITextField by using UIView's -viewWithTag:

这篇关于从行内的文本字段中读取文本,以及如何在表View Row中找到按钮动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆