gpt4 book ai didi

ios - 在编辑模式下将图像添加到 UITableViewCell 未正确对齐

转载 作者:行者123 更新时间:2023-11-30 12:07:50 26 4
gpt4 key购买 nike

我正在使用下面的代码来尝试获得这样的外观:

enter image description here

但它看起来像:

enter image description here

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let deleteRowAction = UITableViewRowAction(style: UITableViewRowActionStyle.default, title: "Delete") { action, indexPath in

}
deleteRowAction.backgroundColor = UIColor.red
deleteRowAction.backgroundColor = UIColor(patternImage: UIImage(named: "DeleteIcon.png")!)
return [deleteRowAction]
}

我做错了什么?

最佳答案

只需更改:

deleteRowAction.backgroundColor = UIColor(patternImage: UIImage(named: "DeleteIcon.png")!)

至:

deleteRowAction.image = UIImage(named: "DeleteIcon.png")

它应该可以工作。

关于ios - 在编辑模式下将图像添加到 UITableViewCell 未正确对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46478078/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com