ios - 如何获取所选行的textLabel并快速保存到firebase?
问题描述
我正在尝试获取我选择并保存到 Firebase 的行的 textLabel 的值。当我一次选择多行时,我想存储到 Firebase 数据库。这是我的代码。
ps 我是 Swift 新手。
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return guestList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "guestListCell", for: indexPath) as! GuestListToTableTableViewCell
let guest: GuestModel
guest = guestList[indexPath.row]
cell.fullNameLabel.text = guest.guestName! + " " + guest.guestFamilyName!
cell.checkedImageView.image = UIImage(named: "unChecked")
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableTableView.deselectRow(at: indexPath, animated: true)
indexArray.append(indexPath.row)
guard let cell = tableView.cellForRow(at: indexPath) as? GuestListToTableTableViewCell else { return }
let name: GuestModel
name = guestList[indexPath.row]
print("\(String(describing: name.guestName))") }
这是我的客人模特
class GuestModel {
var guestName: String?
init(guestName: String?)
self.guestName = guestName }
解决方案
推荐阅读
- javascript - 无法获取输入类型数值
- swift - 使用 Firebase 运行简单项目,但我收到警告
- java - 将 Android Studio 更新到 fox 2020.3.1 后主题插件不起作用
- google-sheets - 谷歌表格在自定义函数中使用命名范围
- javascript - 观察新的字段值并相应地更新路径值
- javascript - 如何将按钮添加到引导弹出窗口?
- javascript - 如何使用 JavaScript 查找剩余时间?
- java - spring service-activator 不适用于 XML 配置中的输出通道属性
- c - 如何在拼写中打印数字?
- at-command - sim800模块中的AT+CSMP命令是什么