ios - 如何使用不可重用的表格 View 单元格?

标签 ios swift uitableview tableview

如何使用不可重复使用的表格 View 单元格?

我的问题:

  • 动态加载玩家姓名的文本字段(输入)
    • 基于玩家数量(之前的 ViewController)
  • 向下滚动到例如球员编号7(外部可见单元格),则之前玩家的文本输入消失并且数据丢失

我的单元格位于tableView(cellForRowAt)中:

let cell = tableView.dequeueReusableCell(withIdentifier: "CellPlayer" , for: indexPath) as! TableViewCellPlayers

如何解决这个问题?我已经在 stackoverflow 上发现了一些问题,但它对我来说从来没有用过..

enter image description here

  • 图 1:初始状态
  • 图 2:填写 6 个文本输入后的状态
  • 图 3:向下滚动 -> 文本输入 8 获取输入 1 的数据
  • 图片 4:向上滚动 -> 完全混合在一起

最佳答案

一种解决方案是存储模型中编写的所有内容,并且在 cellForRow 中,您可以使用保存的数据配置单元。

关于ios - 如何使用不可重用的表格 View 单元格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47556461/

相关文章:

ios - 刷新静态 View Controller

iOS 删除 UITableView 下方的多余空间

ios - UITableViewCell 调整大小不会影响触摸区域

uitableview - dequeueReusableCellWithIdentifier 返回 IOS 7 中处于编辑状态的单元格

ios - 即使应用程序未处于事件状态,也可以在没有警报消息的情况下在 iOS 中接收推送通知

Swift 3 FileManager.default(......).first 是什么意思?

ios - 如何在 View 中显示所有 Apple 表情符号?

ios - 火力地堡错误 : Calls to setPersistenceEnabled must be made before any other usage of FIRDatabase instance

ios - 使用 UISegmentedControl 更改 UIPickerView 标签

ios - UIStatusBar 过渡动画——仅更改 Alpha