-2

我已将 Kingfisher 添加到 tableview 单元格中的 UI 图像,但它无法正常工作。下面是我之前尝试过的代码示例,

directoryPresenter!.getProfileImage(id:(directoryPresenter!.getEmployeeItem(position: indexPath.row).employeeID)) { image in
      cell.profileImage.kf.base.image = image
   // cell.profileImage.image = image
}

我们可以在不传递 URL 的情况下将 Kingfisher 添加到 UI 图像吗?我发现的大多数问题都与 URL 有关。请帮我解决问题

4

1 回答 1

0

如果你使用的是本地保存的图像,则不需要使用 Kingfisher,只需这样做:

cell.profileImage.image = image

如果要使用 url 显示图像,请执行以下操作:

cell.profileImage.kf.setImage(with: {imageURL})
于 2021-08-24T11:29:40.380 回答