I have a small tile image url (50x50) that I want to set for SDAnimatedImageView that occupies full screen. Is it possible to make my source tile image repeat within SDAnimatedImageView in vertical and horizontal axis so it occupies all space? Thus far closest I got to is using contentMode on SDAnimatedImageView to stretch this tile image, but that looks completely off.
Thus far I am not doing anything crazy, just [self sd_setImageWithURL:url]; where self is SDAnimatedImageView
I haven't tried this myself but I think you would have to use the image downloader and then set the image on the ImageView yourself with the tile option set.
- (nullable SDWebImageDownloadToken *)
downloadImageWithURL:(nullable NSURL *)url
completed:
(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
Docs
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
resizingMode:(UIImageResizingMode)resizingMode;
Docs
So I think it would work something like this:
[[SDWebImageManager sharedManager] downloadImageWithURL:imageURL
options:SDWebImageRetryFailed
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
self.imageView.image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With