【发布时间】:2019-09-19 12:53:44
【问题描述】:
我想向 tableview 单元格添加滑动操作,但是当我添加图像而不是背景颜色时,它会返回很多图像。
这是我正在尝试的:
func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .default, title: "") { action, index in
print("more button tapped")
}
delete.backgroundColor = UIColor(patternImage: circularIcon(with: .red, size: CGSize(width: 50, height: 50), icon: #imageLiteral(resourceName: "trash-alt"))!)
let edit = UITableViewRowAction(style: .default, title: "") { action, index in
print("favorite button tapped")
}
edit.backgroundColor = UIColor(patternImage: circularIcon(with: UIColor.appColor(.green)!, size: CGSize(width: 50, height: 50), icon: #imageLiteral(resourceName: "pen-1"))!)
return [delete, edit]
}
【问题讨论】:
标签: ios swift tableview nsindexpath