我在我的应用程序中使用 arc。在我的应用程序中,我在 UIWebView 中播放了 YouTube 视频,视频 url 来自数据库,我将该 url 放在 UITableViewCell 中,我得到内存接收警告。我的数据库记录是 60。任何人都帮帮我。先感谢您
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d",indexPath.row];
VideoCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil)
{
cell =[[VideoCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
[cell.lblVid_Name setText:[[arr_Video objectAtIndex:indexPath.row]valueForKey:@"Video_Name"]];
[cell.lblVid_Desc setText:[[arr_Video objectAtIndex:indexPath.row]valueForKey:@"Video_Desc"]];
NSString *url=[NSString stringWithFormat:@"%@",[[[arr_Video objectAtIndex:indexPath.row]valueForKey:@"Video_Link"]lastPathComponent]];
NSString *youTubeVideoHTML =@"<html><head> <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = \"%f\"/></head> <body style=\"margin-top:0px;margin-left:0px\"> <iframe width= \"%f\" height=\"%f\" src = \"http://www.youtube.com/embed/%@?showinfo=0\"frameborder=\"0\" hd=\"1\" allowfullscreen/>></iframe></div></body></html>";
NSString *html = [NSString stringWithFormat:youTubeVideoHTML,cell.webView_Video.frame.size.width,cell.webView_Video.frame.size.width, cell.webView_Video.frame.size.height,url];
[cell.webView_Video loadHTMLString:html baseURL:nil];
url=nil;
youTubeVideoHTML=nil;
html=nil;
}
return cell;
}