iOS: SDWebImageManager not caching image

前端 未结 1 435
野性不改
野性不改 2021-01-25 00:31

I\'m creating a slideshow using UIImageView, and the image links are in an array , so while I was at it, I learned that SDWebImageManager lets hit the

1条回答
  •  囚心锁ツ
    2021-01-25 00:49

    my mother language is Chinese,not English.Maybe I cannot express my thought clearly,while I will try my best to tell my idea.if I confuse you , I feel sorry.

    I cannot pod SDWebimage because my country blocks google sometimes,so I cannot reproduce your scenarios.While I still give your some advice which may help you

    First of all, your gave us little context.Maybe you can post more information about member variables and properties.When I copy your code to the Xcode.I need add them by myself.

    Second,you mean when you use
    NSURL *imageURL = [NSURL URLWithString:[arry objectAtIndex:1]];,

    sdwebimage hits urls every time , not use cache URLs? you can get the image source by NSLog the cacheType.

    completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {  
                          if (image) {                                                    
                                NSLog(@"%d",cacheType);
                              [activityIndicator removeFromSuperview];
                              activityIndicator = nil;
                              [self.imageView setImage:image];
                         }
                      }];`
    

    SDImageCacheTypeNone means image comes from network.

    SDImageCacheTypeDisk means image comes from disk.

    SDImageCacheTypeMemory means image comes from Memory.

    Third,because the downloadWithURL:options:completed: is excuted not on the main thread. I doubt the sequence is the same with your thought.

    0 讨论(0)
提交回复
热议问题