public override void PrepareForReuse() { base.PrepareForReuse(); PageID = String.Empty; if (chapterView != null) { chapterView.RemoveFromSuperview(); chapterView.Dispose(); chapterView = null; } }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { if (dataType == DataType.CHAPTERS) { var cell = (ChapterCell)collectionView.DequeueReusableCell(cellID, indexPath); var chapter = (list as List <Chapter>)[indexPath.Row] as Chapter; if (chapter != null) { ChapterView chapterView = new ChapterView(book.ID, chapter, indexPath.Row); cell.PageID = chapter.FirstPageID; cell.ChapterImage = chapterView; indexDictionary[chapter.ID] = indexPath; } return(cell); } else { var cell = (ThumbnailCell)collectionView.DequeueReusableCell(cellID, indexPath); if (dataType == DataType.BOOKMARKS) { var bookmark = (list as List <Bookmark>)[indexPath.Row] as Bookmark; if (bookmark != null) { ThumbnailView thumbnailView = new ThumbnailView(bookmark, new CGRect(0, 0, 171, 221)); cell.PageID = bookmark.PageID; cell.ThumbnailImage = thumbnailView; indexDictionary[bookmark.PageID] = indexPath; } } else { var annotation = (list as List <Annotation>)[indexPath.Row] as Annotation; if (annotation != null) { ThumbnailView thumbnailView = new ThumbnailView(annotation, new CGRect(0, 0, 171, 221)); cell.PageID = annotation.PageID; cell.ThumbnailImage = thumbnailView; indexDictionary[annotation.PageID] = indexPath; } } return(cell); } }