This commit is contained in:
2025-12-23 14:02:44 +08:00
parent 6ad2079351
commit 2e1c261775
9 changed files with 23 additions and 9 deletions

View File

@@ -15,6 +15,12 @@ static inline SDWebImageOptions KBWebImageDefaultOptions(void) {
SDWebImageProgressiveLoad; //
}
static inline void KBWebImageEnsureIndicator(UIImageView *imageView) {
if (!imageView.sd_imageIndicator) {
imageView.sd_imageIndicator = SDWebImageActivityIndicator.mediumIndicator;
}
}
static inline NSURL *_KBURL(id url) {
if (!url) return nil;
if ([url isKindOfClass:NSURL.class]) return url;
@@ -32,6 +38,7 @@ static inline NSURL *_KBURL(id url) {
NSURL *u = _KBURL(url);
//
__weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u
placeholderImage:placeholder
options:options
@@ -66,6 +73,7 @@ static inline NSURL *_KBURL(id url) {
}
__weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u
placeholderImage:placeholder
options:options
@@ -106,6 +114,7 @@ static inline NSURL *_KBURL(id url) {
NSDictionary *context = @{ SDWebImageContextImageTransformer : pipeline };
__weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u
placeholderImage:placeholder
options:options