我無法在兩個使用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