public override void PrepareForReuse() { base.PrepareForReuse(); if (noteCellView != null) { noteCellView.RemoveFromSuperview(); noteCellView.Dispose(); noteCellView = null; } }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { var cell = (NoteCell)collectionView.DequeueReusableCell(cellID, indexPath); Note note = dictionary.Skip(indexPath.Section).FirstOrDefault().Value [indexPath.Row]; if (note != null) { NoteCellView noteView = new NoteCellView(bookID, note); noteView.ItemPressedEvent += HandleItemPressedEvent; cell.NoteView = noteView; cell.Frame = new CGRect(cell.Frame.X, cell.Frame.Y, noteView.Frame.Width, noteView.Frame.Height); } return(cell); }