[英]Block doesn't execute
我以这种方式缓存下载和图像,但是我的问题是此queryDiskCacheForDisk
块未执行。
-(void)checkCache :(NSArray *)imgUrl
{
float circleWidth=0.0;
if (dm.screenWidth==320) {
circleWidth=53.0;
}
else if(dm.screenWidth>320)
{
circleWidth=65.0;
}
CGRect circleFrame=CGRectMake(0, 0, circleWidth, circleWidth);
__block UIImage *savedImage=[com circularScaleAndCropImage:[UIImage imageNamed:@"notFound"] frame:circleFrame];
SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"TEAM_PROFILES"];
[imageCache queryDiskCacheForKey:[imgUrl objectAtIndex:0] done:^(UIImage *image,SDImageCacheType cacheType) {
// image is not nil if image was found
if (image) {
savedImage=[com circularScaleAndCropImage:image frame:circleFrame];
NSLog(@"----image Cached------");
}
else
{
//[self performSelectorInBackground:@selector(getImageNew:) withObject:nil];
savedImage=[self getImageNew:imgUrl];
[imageCache storeImage:savedImage forKey:[imgUrl objectAtIndex:0]];
}
}];
[arrayImages addObject:savedImage];
[arrayTeamMemeberNames addObject:[imgUrl objectAtIndex:1]];
[arrayEmpCodes addObject:[imgUrl objectAtIndex:2]];
[arrEmpFullName addObject:[imgUrl objectAtIndex:3]];
[arrEmpNumbers addObject:[imgUrl objectAtIndex:4]];
if([arrayImages count]==[arrayTeamMembersUnfilter count])
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"imagesFilledContact" object:nil];
NSLog(@"------POST NOTIFICATION-----");
}
}
它总是添加我一开始分配的默认图像。 我该如何解决这个问题?
在您的区块中,我没有看到任何add
操作。
您是否知道块是最后运行的部分?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.