使用UITableViewRowAction是很棒的。有一件事困扰着我,我想保留一部分原始的单元格textLabel,这样我亲爱的用户就会知道他们正在删除什么。
通过使用UITableViewRowAction,它将单元格标签从屏幕上推开(参见“我的文本?”绿色的)
有办法绕过这件事吗?

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let editAction = UITableViewRowAction(style: .destructive, title: "Edit") { (rowAction, indexPath) in
//TODO: edit the row at indexPath here
}
editAction.backgroundColor = .gray
let deleteAction = UITableViewRowAction(style: .normal, title: "Delete") { (rowAction, indexPath) in
//TODO: Delete the row at indexPath here
}
deleteAction.backgroundColor = .red
let sendAction = UITableViewRowAction(style: .normal, title: "More") { (rowAction, indexPath) in
//TODO: Delete the row at indexPath here
}
sendAction.backgroundColor = .darkGray
return [deleteAction,editAction,sendAction]
}发布于 2017-10-24 15:04:30
如果您希望您的labelText保持原样,则必须添加一个删除按钮,因为您不能更改此按钮。
https://stackoverflow.com/questions/46907700
复制相似问题