更新时间:2023-10-29 13:53:28
两种策略.
子类UITableViewCell,为您的textField添加一个属性.然后,在 -tableView:willSelectRowAtIndexPath:
中,您可以调用UITableView的 -cellForRowAtIndexPath:
来获取单元格.使用添加的属性访问UITextField.
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: