我正在尝试从服务器下载图像并显示在 320 库的 TTThumbsViewController 中。我无法让这个工作!
当我在本地存储图像时,以下对我有用:
//Create thumbnails
[ImageUtils checkAndSaveThumbnail:imageName andSize:CGSizeMake(100.0, 100.0) andLocation:NO andPrefixof:@"small"];
NSString *fullImageName = [NSString stringWithFormat:@"documents://%@",imageName];
NSString *imageSmallName = [NSString stringWithFormat:@"documents://small-%@",imageName];
NSString *caption = [tempDict objectForKey:@"Comment"];
UIImage *tempImage = [UIImage imageWithContentsOfFile:[appDelegate filePath:imageName]];
MockPhoto *tempPicture = [[MockPhoto alloc] initWithURL:fullImageName smallURL:imageSmallName size:tempImage.size caption:caption photoname:imageName];
[photoArray addObject:tempPicture];
将 photoArray 添加到 MockPhotoSource 中:
self.photoSource = [[MockPhotoSource alloc]
initWithType:MockPhotoSourceNormal
title:@"Photos"
photos:photoArray
photos2:nil
];
[photoArray release];
...但是当我像下面这样给出下载位置时它不起作用!不显示缩略图,也不显示大图!
NSString *url = [delegate downloadImageUrl];
MockPhoto *tempPicture = [[MockPhoto alloc] initWithURL:url smallURL:url size:tempImage.size caption:caption photoname:imageName];
[photoArray addObject:tempPicture];
我一直在使用与 AsyncImage 相同的 URL,它可以下载图像并在 ImageView 中很好地显示!
NSURL *url = [NSURL URLWithString:[delegate downloadImageUrl]];
UIImageView *profileimage = [[UIImageView alloc] init];
AsyncImageView* asyncImage = [[[AsyncImageView alloc] initWithFrame:CGRectMake(0, 10, 60, 60)] autorelease];
asyncImage.imageName = [[users objectAtIndex:indexPath.row] objectForKey:@"Key"];
[asyncImage loadImageFromURL:url];
[profileimage addSubview:asyncImage];
你能否让我知道我在使用 MockPhoto 时有什么问题?
谢谢。