【发布时间】:2017-08-08 13:11:56
【问题描述】:
我正在尝试更改 UITableViewRowAction 的标题,每次用户按下它就像完成/不完整一样,我编写的代码放置了复选标记但没有更改标题,因此无法删除复选标记:
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let completeAction = UITableViewRowAction(style: .normal, title: "Complete", handler: { (action, indexPath) in
if action.title == "Complete"{
action.title = "Incomplete"
cell?.accessoryType = UITableViewCellAccessoryType.checkmark
}
else{
cell?.accessoryType = UITableViewCellAccessoryType.none
action.title = "Complete"
}
tableView.setEditing(false, animated: true)
})
completeAction.backgroundColor = .blue
return [completeAction]
}
有什么建议吗?
【问题讨论】:
标签: swift3 uitableviewrowaction