我无法在两个使用SDWebImage异步下载图片的图像中设置活动指示器。这里是我的代码:无法使用SDWebImage设置活动指示器
if let imgId = experimentFetched[0].backgroundImageId {
print("Inside if")
backgroundImage.sd_setIndicatorStyle(.gray)
backgroundImage.sd_setShowActivityIndicatorView(true)
backgroundImage.sd_setImage(with: URL(string: Constants.apiBaseUrl + "Images/" + imgId), placeholderImage: UIImage(named: "stock"))
foregroundImage.sd_setIndicatorStyle(.gray)
backgroundImage.sd_setShowActivityIndicatorView(true)
foregroundImage.sd_setImage(with: URL(string: Constants.apiBaseUrl + "Images/" + imgId), placeholderImage: UIImage(named: "stock"))
}
我知道,如果环是运行(print语句里面运行..)
你可以使用这个插件一个简单的方法:https://github.com/JJSaccolo/UIActivityIndicator-for-SDWebImage – Kingalione