【发布时间】:2017-07-03 09:48:22
【问题描述】:
我正在尝试更改默认按钮以删除表格视图中的一行(当用户向左滑动时)。 Changing the height of the default confirmation delete button
同时我想在进入编辑模式时在单元格左侧添加自定义图像... [将进入编辑模式时的默认图标改为删除2
我的代码中包含:
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .destructive, title: "\u{267A}\n Delete") { (action, indexPath) in
tableView.isEditing = false
print("delete")
// delete item at indexPath
}
return [delete]
}
是否可以更改确认删除按钮的高度并为左侧图标添加自定义图像?
谢谢! :)
【问题讨论】:
-
是的,这是可能的。您可以再次检查该站点。该问题之前已经提出并回答了
-
我已经看到了答案......而且我肯定做错了......我确实插入了图像......但按钮的高度仍然是相同的行...我要做的是更改按钮的高度并使其与行的高度不同...
标签: ios swift tableview tableviewcell