使用缓存到本地的图片对initWithUrl的进行初始化

NSString *imageB64 = [NSString stringWithFormat:@"%@",[uneImage imageB64]];
NSData *dataImageB64 = [NSData dataFromBase64String:imageB64];
UIImage *imagePNG = [UIImage imageWithData:dataImageB64];

NSString *tempURL = [[TTURLCache sharedCache] storeTemporaryImage:imagePNG toDisk:NO];

MockPhoto *unePhoto = [[[MockPhoto alloc] initWithURL:tempURL 
smallURL:tempURL 
size:CGSizeMake(imagePNG.size.width, imagePNG.size.height) 
caption:[uneImage commentaireImage]] autorelease];

 

 

原始链接http://www.iphonedevsdk.com/forum/iphone-sdk-development/35838-problem-ttphotoviewcontroller-uitabbarcontroller.html

 

项目中的链接

 

TTURLCache *cache = [TTURLCachesharedCache];

    NSMutableArray *photoResource = [NSMutableArrayarray];

    for (ImageCustomProperty *item inself.imageUrlSource) {

        

        UIImage *imagePNG = [UIImage imageWithData:[cache dataForURL:item.imageUrl]];

        NSString *tempURL = [[TTURLCache sharedCache] storeTemporaryImage:imagePNG toDisk:NO];        

        Photos *photo = [[Photos alloc] initWithURL:item.imageUrl smallURL:tempURL size:CGSizeMake(320, 480)];

        [photoResource addObject:photo];

        TT_RELEASE_SAFELY(photo);

    }

    DLog(@"new image is %@", self.imageUrlSource);

    self.photoSource = [[PhotoSourcealloc] initWithType:PhotoSourceNormaltitle:nilphotos:photoResource photos2:nil];

    

    [self.tableViewreloadData];

 

posted @ 2012-05-03 23:04  worldworld  阅读(272)  评论(0编辑  收藏  举报