【发布时间】:2018-07-07 12:51:30
【问题描述】:
我有一个表格视图,每个单元格中有一个文本字段。我添加了一个这样的目标:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customLevelCell") as! LevelTableViewCell
cell.cellTextField.addTarget(self, action: #selector(ViewController.TextfieldEditAction), for: .editingDidEnd)
return cell
}
但发现我无法使用 indexpath.row / sender.tag 来获取特定的文本字段文本
@objc func TextfieldEditAction(sender: UIButton) {
}
所以我的问题是如何在用户编辑其中一个文本字段后获取文本。
另外,我如何获取 indexpath.row 或 sender.tag,它们将用于收集他们添加到特定文本字段的文本。
【问题讨论】:
-
选择器中的函数参数在哪里
-
@RahulGUsai 更新了问题
标签: ios swift uitableview