ios - I want cache images without show them in any imageView how do this i want do progress while I´m change to use the by url later -
sdwebimagedownloader *downloader = [sdwebimagedownloader shareddownloader]; [downloader downloadimagewithurl:[[nsurl alloc] initwithstring:url] options:0 progress:^(nsinteger receivedsize, nsinteger expectedsize) { // progression tracking code } completed:^(uiimage *image, nsdata *data, nserror *error, bool finished) { if (image && finished) { }});
try one:
-(uiimage *)downloadimageasync:(nsstring *)imagekey { nslog(@"image key : %@",imagekey); __block uiimage *returnedimage; sdwebimagemanager *manager = [sdwebimagemanager sharedmanager]; [manager downloadwithurl:[nsurl urlwithstring:imagekey] options:0 progress:^(nsuinteger receivedsize, long long expectedsize){ nslog(@"received size %d expected size %lld", receivedsize, expectedsize); }completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype,bool finished){ if(image && finished) { returnedimage = image; } }]; if(returnedimage == nil) { nslog(@"returned image nil"); } return returnedimage; }
Comments
Post a Comment