iphone - sdwebImage setImageWithURL: placeholderImage: completed: -


i use sdwebimage new version , call:

    self.imgindicatorview.center=self.img.center;     self.imgindicatorview.hidden=no;     [ self.imgindicatorview startanimating];     __block uiactivityindicatorview *indicatorview= self.imgindicatorview;       nslog(@"mytopics.img.small=%@",mytopics.img.small);     [self.img setimagewithurl:[nsurl urlwithstring:@"http://ww1.sinaimg.cn/thumbnail/acc940bdj.jpg"]                            placeholderimage:nil completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype){                                  nslog(@"newimagenotcached:break.png  mytopics.img.small" );                                if(!error ){                                     cgrect  sframe=self.img.frame;                                     cgsize newsize=image.size;                                     if (newsize.height>80) {                                         if (newsize.width>newsize.height) {                                            newsize.height=newsize.height *80.0/image.size.width;                                            newsize.width=80;                                        }else{                                            newsize.height=80;                                            newsize.width=newsize.width*80.0/image.size.height;                                         }                                      }else{                                        if (newsize.width>80) {                                            newsize.height=newsize.height *80.0/image.size.width;                                            newsize.width=80;                                        }else{                                         }                                     }                                    sframe.size=newsize;                                    self.img.frame=sframe;                                     indicatorview.hidden=yes;                                    [indicatorview stopanimating];                                    [indicatorview removefromsuperview];                                }else{                                     self.img.image=[uiimage newimagenotcached:@"break.png"];                                     indicatorview.hidden=yes;                                    [indicatorview stopanimating];                                    [indicatorview removefromsuperview];                                }                              }]; 

but log nslog(@"newimagenotcached:break.png mytopics.img.small" ),not show if url(@"http://ww1.sinaimg.cn/thumbnail/acc940bdj.jpg") break.so indicatorview exist. why method not call block completed?

in. uiimageview + webcache.m line 55.

   if (url) {     __weak uiimageview *wself = self;     id<sdwebimageoperation> operation = [sdwebimagemanager.sharedmanager downloadwithurl:url options:options progress:progressblock completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished)     {         __strong uiimageview *sself = wself;         if (!sself) return;         if (image)         {             sself.image = image;             [sself setneedslayout];         }         if (completedblock && finished)  // note: finished == yes, completedblock called.          {             completedblock(image, error, cachetype);         }     }];     objc_setassociatedobject(self, &operationkey, operation, objc_association_retain_nonatomic); } 

in sdwebimagemanager.m line 81

 if (!url || !completedblock || (!(options & sdwebimageretryfailed) && [self.failedurls containsobject:url])) // note: failedurls contain url {     // tips:  error occured,  nothing     if (completedblock) {         // note: finished flag no. please set yes, , try again.         completedblock(nil, nil, sdimagecachetypenone, no);      }     return operation; } 

so completedblock wrote called on first time(when error occurred).


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -