在我的应用程序中,我从 UITableview 中的服务器获取视频链接。所有这些链接都存储在服务器上的文本文件中。但我想在 UITableview 中获取这些链接的缩略图。这是我的形象。
由于我的屏幕截图显示了我从服务器获取的链接,但这些链接的缩略图没有显示在红色圆圈中。这些红色圆圈是我的 webviews。这是我的代码。
- (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 时,它会显示类似这样的内容。
任何人都可以指导我我犯了什么错误。提前谢谢。