ios - 从其他表格 DidSelect 方法更新表格单元格数据
问题描述
我有一个UITableView
withUITexField
里面有两个。和里面Second UITableView
。two UILabel
检查图像。
现在想要当用户单击Add Button
. Menu popUp with a table View
(称为tblPassList
) 现在,当用户选择 RowName
并将Age
更新到该特定单元格时。
这是我所做的,但仅在 First Cell.Check 图像上更新。在此处输入图像描述
变量名称2 =“”
变种年龄2 =“”
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cellToReturn = UITableViewCell()
if tableView == tblOnWard {
let Cell = tableView.dequeueReusableCell(withIdentifier: "TblOnward", for: indexPath) as! TblOnward
Cell.selectionStyle = .none
Cell.shawdow(viewShadow: Cell.ViewCell)
Cell.lblSeatNo.text = "Seat No. " + arrSeatNoOnward[indexPath.row]
Cell.lblHead.text = ArrHeadTitle[indexPath.row]
Cell.txtName.text = self.name2
Cell.txtAge.text = self.age2
self.age2 = ""
self.name2 = ""
cellToReturn = Cell
}
return cellToReturn
}
选择
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if tableView == tblPassList {
let cell = tableView.cellForRow(at: indexPath) as! GetpassList
name2 = cell.lblName.text!
age2 = cell.lblAge.text!
self.tblReturn.reloadData()
self.tblOnWard.reloadData()
}
}
有什么建议吗?
解决方案
推荐阅读
- python - 如何立即退出一组循环并返回第一个循环?
- java - 我是否需要一个带有经常从站点消耗休息 api 的 java 应用程序的数据库?
- applescript - 使用 AppleScript 中的特定 x、y 坐标裁剪图像
- html - 当有水平滚动时,为什么不将块元素扩展到其子项的显式宽度
- windows - TLS 1.1 不会在 Windows Server 2008 R2 上禁用
- r - 收集 Shiny R 中的所有输入标签
- php - 致命错误:未捕获的错误:不能使用 PDOStatement 类型的对象作为数组
- ios - 如何使用计时器停止长时间运行的功能?斯威夫特 4
- azure - 如何获取 Devops OwnerID
- javascript - 用 JSON 替换 D3.js CSV 源