我正在使用SDWebImage设置单元格按钮图像:
cell.categoryButton.sd_setImage(with: URL(string:cell.image), for: .normal, placeholderImage: UIImage(named: "image"))
答案 0 :(得分:0)
由于您要设置按钮(sd_setBackgroundImage
的背景图像,而不是将图像设置为UIButton
,因此需要使用UIImageView
属性。
cell.categoryButton.sd_setBackgroundImage(with: URL(string:cell.image), for: .normal, completed: nil)