sd_setImage显示蓝色图像

问题描述 投票:-1回答:1

我正在使用SDWebImage来设置单元格按钮图像:

cell.categoryButton.sd_setImage(with: URL(string:cell.image), for: .normal, placeholderImage: UIImage(named: "image"))

但我得到的是像这样的蓝色图像:我不知道为什么enter image description here

swift uibutton sdwebimage
1个回答
0
投票

您需要使用sd_setBackgroundImage属性,因为您正在设置按钮的背景图像(UIButton),而不是将图像设置为UIImageView

cell.categoryButton.sd_setBackgroundImage(with: URL(string:cell.image), for: .normal, completed: nil)
© www.soinside.com 2019 - 2024. All rights reserved.