sdwebimage

How to save image permanently by using sdwebimage?

只谈情不闲聊 提交于 2019-12-11 16:57:11
问题 I'm the new on swift. I have a question how to save image from url into permanent cache. Since URL live for only 30min and is expired after 30min, I'm using sdwebimage and saving image in disk and memory cache. My code is like the below. and it's working well. Problem is that sometimes image is not loaded because of unknown issue. I guessed that image is not saved permanently in cache..This is just my guess. So, I'd like to save image permanent cache. How can I do this? Or Is there anyone

How to load image with SDWebImage correctly in UICollectionView in swift

放肆的年华 提交于 2019-12-11 16:39:32
问题 I'm facing the following problem, well I have a custom collection view, where I upload an image from the URL I get from a service, everything works fine at the moment but sometimes when scrolling or when I leave the screen and return, my collection view customized it is altered, it does not load correctly, I have seen several posts where they present the same problem in different cases, but trying to conclude that my problem is at the moment of using the SDWebImage library. I have seen that

Why did the SDWebImage redraw imageSource in the connection:didReceiveData: method?

只愿长相守 提交于 2019-12-11 15:55:10
问题 look at the code snippet below. i don't understand the code between #ifdef TARGET_OS_IPHONE and #endif,should i redraw a new image from the imageSource? why? - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [self.imageData appendData:data]; if ((self.options & SDWebImageDownloaderProgressiveDownload) && self.expectedSize > 0 && self.completedBlock) { // Get the total bytes downloaded const NSInteger totalSize = self.imageData.length; // Update the data source,

Lazy loading images in UICollectionView with SDWebImageManager

瘦欲@ 提交于 2019-12-11 12:39:49
问题 In my method cellForItemAtIndexPath i have this code: SDWebImageManager *manager = [SDWebImageManager sharedManager]; [manager downloadWithURL:[NSURL URLWithString:coverURL] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) { RRRBigItemCell *cell = (RRRBigItemCell *)[collectionView cellForItemAtIndexPath:indexPath]; if (cell) { RRRImageView *coverView = (RRRImageView *)[cell

How to cancel download with SDWebImageDownloader

大城市里の小女人 提交于 2019-12-11 12:35:18
问题 I'm using SDWebImageDownloader to download an image and then show it on a cell, but I have the issue that if the image doesn't finish download once the view is unloaded, it causes that my app crashes. I'm using the code that is provided on the github page: [SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageURL options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { // progression tracking code } completed:^(UIImage *image, NSData *data, NSError *error, BOOL

Image appears only after scroll TableView

时间秒杀一切 提交于 2019-12-11 12:06:00
问题 I have TableView with several text fields and image. For Image loading I use SDWebImage Library. Here is code for TableView Source public class ExperienceSource : UITableViewSource { //UINavigationController instance, to pass it to constructor private UINavigationController primNav { get; set; } private UITableView tableView { get; set; } List<Experience> TableItems; ExperienceTableViewController owner; public ExperienceSource(List<Experience> items,ExperienceTableViewController owner,

images from foursquare are NSURLErrorFileDoesNotExist = -1100

我怕爱的太早我们不能终老 提交于 2019-12-11 09:15:02
问题 I am attempting to download an image from foursquare( sourced from using the venue api) and I keep getting NSURLErrorFileDoesNotExist = -1100, errors for trying to grab the image. imageUrl = [NSURL URLWithString: [NSString stringWithFormat: [@"https://irs0.4sqi.net/img/general/720x400/1203715_jAVNrPE87IFuOUa69i1q5UXQ0bUAfjG8V-R_hBUL09c.jpg" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; //[cell.venueImageView sd_setImageWithURL:imageUrl placeholderImage:nil]; typeof

Is there any way to stop an image in a UIImageView from lazy loading with SDWebImage on iOS?

与世无争的帅哥 提交于 2019-12-11 08:58:14
问题 I'm using the following code to lazy load an image into my UIImageView: [self.imv1 setImageWithURL:[NSURL URLWithString:myURL] placeholderImage:[UIImage imageNamed:@"loading.png"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) { // stuff here }]; When a user touches a button, I want the lazy loading of this to STOP completely, so that no image gets loaded and the download of the image stops. After I stop the lazy loading, I plan to load a different image into the same

Only last image is loading from url in scrollview

谁说我不能喝 提交于 2019-12-11 07:58:51
问题 In my iOS app I have have a lots of view and image and labels are the subviews of the. view. My problem is while loading images from url or remote server only last image is loading from url . Other images are loaded with placeholders. Tried many ways but unable to solve it . My code and screenshot are provided below catScrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 10, self.view.frame.size.width,300)]; catScrollView.contentSize = CGSizeMake(([popularCategoryArray count] * 90)/1.8

SDWebImage change cacheMaxCacheAge

醉酒当歌 提交于 2019-12-11 03:04:16
问题 How I can change a static value cacheMaxCacheAge when I use SDWebImage? What way is good? I need to cache images for 5 minutes. 回答1: In SDWebImage 5.0+ maxCacheAge renamed to maxDiskAge. You can set maximum caching time in seconds like this. Objetive-c [SDImageCache sharedImageCache].config.maxDiskSize = 60 * 5; //5 minutes Swift 4+ SDImageCache.shared.config.maxDiskAge = 60 * 5 //5 minutes Reference link: https://github.com/SDWebImage/SDWebImage/wiki/5.0-Migration-guide 回答2: SDWebImage is