Пример #1
0
        public override void PrepareForReuse()
        {
            base.PrepareForReuse();

            PageID = String.Empty;

            if (thumbnailView != null)
            {
                thumbnailView.RemoveFromSuperview();
                thumbnailView.Dispose();
                thumbnailView = null;
            }
        }
Пример #2
0
        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);
            }
        }