【发布时间】:2015-12-30 03:16:23
【问题描述】:
我必须将许多图像加载到UICollectionView。当我滚动UICollectionView 时,我觉得滚动到下一页时有点滞后。是因为我在进入下一页时加载了 12 张图片吗?如果是,我该如何解决。下面是我的代码。
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"TestAZCollectionViewCell";
TestAZCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
imgPath = [imgDir stringByAppendingPathComponent:[[itemArray objectAtIndex:indexPath.row]objectForKey:@"IM_ImgName"]];
cell.cellImage.image = [UIImage imageWithContentsOfFile:imgPath];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"no_image.jpg"]];
return cell;
}
有人可以帮忙吗?
【问题讨论】:
-
SDWebImage 可以用来加载本地路径图片吗?请指教
-
Nope..顾名思义
Web
标签: objective-c uicollectionview