我们已经设置了 collectionviewSource 和 collectionview,但是在滚动时遇到了性能问题。我们目前这样管理单元格:
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var to = base.GetCell(collectionView, indexPath) as AnimalCell;
to.SetParentLocation(_parent);
return to;
}
我的问题是这是否管理基类中的出队?
如果不是,最好的方法是使用标准出队
public override UICollectionViewCell GetCell (UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
{
var animalCell = (AnimalCell)collectionView.DequeueReusableCell (animalCellId, indexPath);
var animal = animals [indexPath.Row];
animalCell.Image = animal.Image;
return animalCell;
}
当我尝试使用单元格时,更改为上述代码会导致它崩溃。我是否需要更改我的 Cell 类或 collectionview 的设置方式?