在我的应用程序中,我从UITableview中获取Sever的视频链接。所有这些链接都存储在server.text中的文本文件中,但我想要在UITableview中获取这些链接的缩略图。这是我的形象。如何在UITableview中显示视频缩略图?
由于我的屏幕截图显示这是我从服务器上获取的链接,但在红色圆圈这些链接不显示缩略图。这些红色圆圈是我的webviews.here是我的代码。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @"CustomCellIdentifier ";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
// Set up the cell.
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, [Listdata objectAtIndex:indexPath.row], cell.webSal.frame.size.width, cell.webSal.frame.size.height];
cell.lblSal.text = [Listdata objectAtIndex:indexPath.row];
[cell.webSal loadHTMLString:html baseURL:nil];
return cell;
}
当我使用NSlog时,它显示了一些这样的事情。
任何人都可以指导我,我犯了什么错误。提前收到。
看看这个问题:http://stackoverflow.com/questions/3405059/how-to-show-youtube-video-thumbnails – joern
请在nslog之前写下html的值[cell.webSal loadHTMLString:html baseURL:nil] ; –