Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FFFastImageView.m #1013

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions ios/FastImage/FFFastImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,24 @@ - (void) reloadImage {
}

- (void) downloadImage: (FFFastImageSource*)source options: (SDWebImageOptions)options context: (SDWebImageContext*)context {
UIImage *placeholderImage;
if(_source.cacheControl == FFFCacheControlCacheOnly){
if (isCached) {
placeholderImage = nil;
}
else{
placeholderImage = [UIImage imageNamed:@"defaultArticleImage"]; (*Add a placeholder image named "defaultArticleImage.png" in 1x and 2x size in ImageAssests from xcode where splash and icons are added *)
}
}
else{
placeholderImage = nil;
}
__weak typeof(self) weakSelf = self; // Always use a weak reference to self in blocks
[self sd_setImageWithURL: _source.url
placeholderImage: _defaultSource

[self sd_setImageWithURL:_source.url
placeholderImage: placeholderImage
(* [self sd_setImageWithURL: _source.url
placeholderImage: _defaultSource *)
options: options
context: context
progress: ^(NSInteger receivedSize, NSInteger expectedSize, NSURL* _Nullable targetURL) {
Expand Down