1
클래스 UIImageView+WebCache.h
을 사용하여 지연로드를 성공적으로 구현했습니다. UIImageView+WebCache.h
클래스를 사용하지 않고 지연로드를위한 쉬운 방법이 있습니까?쉬운 게으른 로딩
클래스 UIImageView+WebCache.h
을 사용하여 지연로드를 성공적으로 구현했습니다. UIImageView+WebCache.h
클래스를 사용하지 않고 지연로드를위한 쉬운 방법이 있습니까?쉬운 게으른 로딩
UIWebView에서 이미지를로드 할 수 있습니다. 예 :
-(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"ID";
UITableViewCell *cell = [self.tv dequeueReusableCellWithIdentifier:identifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
UIWebView *webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
NSLog(@"URL=%@",[arrayURL objectAtIndex:indexPath.row]);
NSURL *url=[NSURL URLWithString:[arrayURL objectAtIndex:indexPath.row]];
NSURLRequest *req=[NSURLRequest requestWithURL:url];
[webView loadRequest:req];
webView.scalesPageToFit=TRUE;
[cell.contentView addSubview:webView];
}
return cell;
}
나는 두 가지 잠재적 인 문제점을 보았습니다. 1. UIWebView는 새로 할당 된 * 세포에만 추가되었지만 * 재사용되는 세포에는 추가되지 않습니다. *. 2.'loadRequest'는 비동기 적으로 동작하기 때문에 요청이 끝나면 셀은 다른 행에 대해 * 재사용 *되었을 수 있습니다. –