【发布时间】:2017-07-24 14:16:27
【问题描述】:
我正在使用“接受”滑动操作。当我单击滑动按钮时,一切都在 Web 服务器上运行良好,但 tableView 没有得到更新。实际上我在getOnay函数中使用了tableView.reloadData(),但它不起作用。
有趣的是,当我按两次滑动操作按钮时,它会删除 tableView 上的行。
这是我的代码:
override func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? {
let onay = UITableViewRowAction(style: .normal, title: "Accept") { action, index in
let ip = editActionsForRowAt.row
let taskInfo:Task = self.onayArray[ip]
self.getOnay(id: taskInfo.id, status: "okay")
self.onayArray.remove(at: index.row)
self.loadOnaylar(userID: self.onayCode.userId, code: self.onayCode.systemCode)
}
onay.backgroundColor = .green
return [onay]
}
【问题讨论】:
-
可以分享一下你的loadOnaylar方法代码吗?
-
基本上它只是一个 josn 邮政编码。我可以共享 loadOnaylar,但问题是,当我运行调试时,此函数在行操作 onay var 中根本不起作用。这怎么可能?
标签: ios swift uitableview reloaddata