0

I am Trying to integrate SdWebImage With Youtube Api for the purpose of Fetching thumbnail image to cache them so as get rid of scrolling problem in UITableView.Problem is Youtube API Provide a URL that is for Thumbnail NSDATA which can be converted back to UIImage object but SDWebImage is Takes URL to an image to manage images in best efficient method.

Youtube Api Method:

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[thumbnails objectAtIndex:0] URLString]]];
UIImage * image = [UIImage imageWithData:data];

SDWebImage Method

[cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
               placeholderImage:[UIImage imageNamed:@"placeholder"]];

Please Tell How We Solve this Problem.

4

1 に答える 1

0

あなたはこの問題を考えすぎていると思います。これを行うことができるはずです:

NSURL *thumbnailURL = [NSURL URLWithString:[[thumbnails objectAtIndex:indexPath.row] URLString]]];

[cell.imageView setImageWithURL:thumbnailURL
               placeholderImage:[UIImage imageNamed:@"placeholder"]];
于 2012-08-13T22:21:22.850 に答える