繁体   English   中英

从tableView中的文件夹加载图像缓慢

[英]Loading images from folder in tableView slow

我已经从tableView的文件夹中加载了具有自定义单元格的图像,该单元格每行具有三张图像。即使我调整了图像的大小,它在上下滚动时也很慢

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";

CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
    cell = customCell;
}

if ([imageLists count] > indexPath.row*noOfImageInRow) {

    ImagesClass *Obj1 = [imageLists objectAtIndex:indexPath.row*noOfImageInRow];

    UIImage *image1 = [self getImageForImageId:Obj1.imageId FromPath:SAVEDIMAGE_DIR];
    Obj1.thumbImage = [self imageWithImage:image1 convertToSize:CGSizeMake(130, 130)];

    [cell setImage:1 :Obj1.thumbImage RowNo:indexPath.row*noOfImageInRow];

表格视图中没有延迟加载

   [cell setImage:2 :Obj2.thumbImage RowNo:indexPath.row*noOfImageInRow+1];

这些功能需要更多时间才能执行

UIImage *image1 = [self getImageForImageId:Obj1.imageId FromPath:SAVEDIMAGE_DIR];
Obj1.thumbImage = [self imageWithImage:image1 convertToSize:CGSizeMake(130, 130)];

请向Apple寻求延迟加载图像的概念。

我不会描述什么是延迟加载,希望这对您有用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM