-(void)setWebImage:(NSURL *)aUrl placeHolder:(UIImage *)placeHolder downloadFlag:(int)flag{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
//配置下載路徑
NSString *path=[NSHomeDirectory() stringByAppendingFormat:@"/Library/Caches/%lu",(unsigned long)aUrl.description.hash];
NSData *data=[NSData dataWithContentsOfFile:path];
if (!data) {
NSLog(@"准備下載到沙盒路徑:%@",path);
data=[NSData dataWithContentsOfURL:aUrl];
[data writeToFile:path atomically:YES];
}
UIImage *image=[UIImage imageWithData:data];
dispatch_async(dispatch_get_main_queue(), ^{
if (self.tag==flag) {
[self setImage:image];
}
});
});
}