相关疑难解决方法(0)

如何在UITableViewRowAction中添加图像?

我正在尝试以UITableView滑动样式添加图像.我尝试使用Emoji文本及其工作正常

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
  let editAction = UITableViewRowAction(style: .normal, title: "") { (rowAction, indexPath) in
      print("edit clicked")
  }

  return [editAction]
}
Run Code Online (Sandbox Code Playgroud)

但我需要图像而不是表情符号,同时我试过

editAction.backgroundColor = UIColor.init(patternImage: UIImage(named: "edit")!)
Run Code Online (Sandbox Code Playgroud)

但它正在获得重复的图像,我使用了许多格式的图像,如20*20,25*25,50*50,但仍然重复.

我该如何添加图片?

uitableview ios swift

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×1

swift ×1

uitableview ×1