相关疑难解决方法(0)

UICollectionview加载单元格时滚动波动

我在我的应用程序中使用了一个库UICollectionView.细胞大小约为70,70.我使用ALAssetsALAssetLibrary我在其中已经存储在列表中的画廊.

我使用通常的模式来填充单元格:

-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

  mycell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
  mycell.imageView.image = [[UIImage imageWithCGImage:[alassetList objectAtIndex:indexpath.row] thumbnail]];
  return mycell;
}
Run Code Online (Sandbox Code Playgroud)

我的画廊滚动波涛汹涌.我不明白为什么会这样.我已经尝试添加一个NSCache来缓存缩略图(想想可能创建图像很昂贵),但这对性能没有帮助.

我希望用户界面像股票应用程序一样黄油.

我现在怀疑它可能是某种东西UICollectionViewCell prepareForReuse可能会阻碍dequeueReusableCellWithReuseIdentifier方法,但使用我无法找到的工具.

还有其他可能造成这种情况的事吗?是否有一种"更快"的方式以更快的方式UICollectionViewCelldequeue它们做准备?

objective-c ios xcode-instruments uicollectionview uicollectionviewcell

33
推荐指数
3
解决办法
4万
查看次数