2013-08-09 2 views
0

UIWebView을 사용하여 UITableView 안에 Youtube 비디오를로드합니다. 모든게 다 잘 작동합니다. 로드 할 때마다 제가 tableview를 스크롤합니다. 이 질문 (UIWebView in UITableView reloads everytime I scroll. How do I prevent it from reloading?)을 읽었지만 아직 해결되지 않았습니다.UITableViewCell 내의 UIWebView 스크롤 할 때마다 콘텐츠로드

내 코드 : 당신은 왜 것은 이것이,

[cell.myWebview loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]]; 

매번 호출

NSString *videoUrl =[NSString stringWithFormat:@"src=\"http://www.youtube.com/embed/%@\"",  videoId]; 
      NSString *htmlString =[NSString stringWithFormat:@"<iframe width=\"273\" height=\"152\" %@ frameborder=\"0\" allowfullscreen></iframe>", videoUrl]; 
      NSLog(@"%@", htmlString); 
      cell.myWebview.scrollView.scrollEnabled = NO; 
      cell.myWebview.scrollView.bounces = NO; 
      [cell.myWebview loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]]; 
      [cell.contentView addSubview:cell.myWebview]; 

답변

1

. 어쩌면 다른 장소에서 webviews를로드 한 다음 cellForRowIndexPath 메소드에서 다음과 같이 태그를 붙일 수 있습니다.

cell.myWeview = "....already loaded webview" 
+0

코드를 줄 수 있습니까? 미안 나는 아직도 이해하지 않는다. :) – Jacki

관련 문제