我已经使用该类成功实现了延迟加载UIImageView+WebCache.h。有没有不使用类的懒加载的简单方法UIImageView+WebCache.h?
1 回答
            1        
        
		
您可以在 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;
    }
    于 2012-08-18T22:06:28.963   回答