views:

128

answers:

0

I'm working on my first iPhone app, and everything is going pretty good, however I got a problem that I can't solve.

I created an rss reader that retrieves a title and a youtube link. I placed the youtube link in a UIwebview and the title next to that.

But when I scroll through the list the youtube thumbs that are created keep reloading as soon as they aren't directly on screen. So when I scroll down and up again all the thumbs need to reload.

Is there a way to cache this, are make sure iphone doesn't reload the thumbnails?

Note I turned off the reuable cells to check if that perhaps work, but then I just get empty places instead off image replacements from youtube.

    self.tabel = tableView;

   static NSString *newsCellIdentifier = @"NewsCell";

NewsCell *cell = (NewsCell*) [tableView dequeueReusableCellWithIdentifier:newsCellIdentifier];
if (cell == nil) {
    cell = [[[NewsCell alloc] initWithFrame:CGRectZero reuseIdentifier:newsCellIdentifier] autorelease];
}



NewsItem * nextNewsItem = [rssParser.newsArray objectAtIndex:indexPath.row];
cell.titleLabel.text = nextNewsItem.title;

cell.datumLabel.text = nextNewsItem.datum;

NSString *htmlString = [NSString stringWithFormat:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"YouTubeTemplate" ofType:@"txt"]], nextNewsItem.video, nextNewsItem.video, nil];
[cell.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://youtube.com"]];