【发布时间】:2017-11-13 22:30:10
【问题描述】:
如何在 UIContextualAction 期间和之后删除 UITableViewCell 中的文本? (如果不能在此期间完成,只有在之后会有帮助)
func tableView(_ tableView: UITableView,
leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let doneAction = UIContextualAction(style: .normal, title: "DONE", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
print("Done left")
self.dailyTasks.append("\(self.dailyTasks[indexPath.row])")
self.dailyTasks.remove(at: indexPath.row)
UserDefaults.standard.set(self.dailyTasks, forKey: "dailyTasks")
self.dailyTable.reloadData()
success(true)
})
doneAction.backgroundColor = .darkGray
return UISwipeActionsConfiguration(actions: [doneAction])
}
【问题讨论】:
标签: ios arrays swift uitableview