使用DLImageLoader iOS
有没有人能帮我把这些结合起来 下面是我的代码。。。我不理解,因为我的图像是从核心数据中的NSString而不是URL加载的(可能我无法使用此帮助文件) 我的代码是:使用DLImageLoader iOS,image,Image,有没有人能帮我把这些结合起来 下面是我的代码。。。我不理解,因为我的图像是从核心数据中的NSString而不是URL加载的(可能我无法使用此帮助文件) 我的代码是: SCTableViewSection *Section3 = [self.tableViewModel sectionAtIndex:0]; Section3.cellActions.lazyLoad = ^(SCTableViewCell *cell, NSIndexPath *indexPath) {
SCTableViewSection *Section3 = [self.tableViewModel sectionAtIndex:0];
Section3.cellActions.lazyLoad = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
{
DLImageView *imageView = (DLImageView *)[cell viewWithTag:1];
NSString *imageString = (NSString *)[cell.boundObject valueForKey:@"thumbnail"];
NSString *fullName = [NSString stringWithFormat:@"Documents/%@", imageString];
NSString *imagePath = [NSHomeDirectory() stringByAppendingPathComponent:fullName];
UIImage *originalImage = [UIImage imageWithContentsOfFile:imagePath];
NSLog(@"added image from lazyload");
// size of actual thumbnail to display in cell
CGSize destinationSize = CGSizeMake(154,95); // size of actual thumbnail
UIGraphicsBeginImageContext(destinationSize);
[originalImage drawInRect:CGRectMake(0,0,destinationSize.width,destinationSize.height)];
UIImage *thumbnail = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[UIView transitionWithView:imageView
duration:2.25f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
imageView.image = thumbnail;
} completion:nil];
};
这一行中是否有图像->UIImage*originalImage=[UIImage imageWithContentsOfFile:imagePath]?并尝试使用[imageView setNeedsDisplay];在imageView.image=缩略图之后。