PSPDFThumbnailViewController


@interface PSPDFThumbnailViewController
    : UICollectionViewController <UICollectionViewDataSource,
                                  UICollectionViewDelegate,
                                  PSPDFViewModePresenter>

The thumbnail view controller.

  • Data source to get double page mode.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFPresentationContext> _Nullable dataSource;

    Swift

    @IBOutlet weak var dataSource: PSPDFPresentationContext? { get set }
  • Delegate for the thumbnail controller. - note: If this instance has been created by PSPDFViewController the delegate is already linked and should not be changed.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFThumbnailViewControllerDelegate> _Nullable delegate;

    Swift

    @IBOutlet weak var delegate: PSPDFThumbnailViewControllerDelegate? { get set }
  • Get the cell for certain page. Compensates against open filters. - note: document is ignored in the default implementation.

    Declaration

    Objective-C

    - (nullable UICollectionViewCell *)cellForPageAtIndex:(NSUInteger)pageIndex
                                                 document:(nullable PSPDFDocument *)
                                                              document;

    Swift

    func cellForPage(at pageIndex: UInt, document: PSPDFDocument?) -> Any!
  • Scrolls to specified page in the grid. - note: document is ignored in the default implementation.

    Declaration

    Objective-C

    - (void)scrollToPageAtIndex:(NSUInteger)pageIndex
                       document:(nullable PSPDFDocument *)document
                       animated:(BOOL)animated;

    Swift

    func scrollToPage(at pageIndex: UInt, document: PSPDFDocument?, animated: Bool)
  • Stops an ongoing scroll animation.

    Declaration

    Objective-C

    - (void)stopScrolling;

    Swift

    func stopScrolling()
  • Call to update any filter (if set) all visible cells (e.g. to show bookmark changes)

    Declaration

    Objective-C

    - (void)updateFilterAndVisibleCellsAnimated:(BOOL)animated;

    Swift

    func updateFilterAndVisibleCells(animated: Bool)
  • Defines the filter options. Set to nil or empty to hide the filter bar. Defaults to PSPDFThumbnailViewFilterShowAll, PSPDFThumbnailViewFilterAnnotations, PSPDFThumbnailViewFilterBookmarks.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, null_resettable)
        NSArray<NSString *> *filterOptions;

    Swift

    var filterOptions: [String]! { get set }
  • Currently active filter. Make sure that one is also set in filterOptions.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) NSString *_Nonnull activeFilter;

    Swift

    var activeFilter: String { get set }
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFThumbnailViewController
        : UICollectionViewController <UICollectionViewDataSource,
                                      UICollectionViewDelegate,
                                      PSPDFViewModePresenter>
  • Class used for thumbnails. Defaults to PSPDFThumbnailGridViewCell and customizations should be a subclass of thereof. - see: -[PSPDFViewModePresenter cellClass]

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) Class _Nonnull cellClass;

    Swift

    var cellClass: AnyClass { get set }
  • Returns a suitable size for a thumbnail of a page in a given container size.

    Declaration

    Objective-C

    + (CGSize)automaticThumbnailSizeForPageWithSize:(CGSize)pageSize
                                  referencePageSize:(CGSize)referencePageSize
                                      containerSize:(CGSize)containerSize
                                   interitemSpacing:(CGFloat)interitemSpacing;

    Swift

    class func automaticThumbnailSizeForPage(with pageSize: CGSize, referencePageSize: CGSize, containerSize: CGSize, interitemSpacing: CGFloat) -> CGSize
  • Subclass to customize thumbnail cell configuration.

    Declaration

    Objective-C

    - (void)configureCell:(nonnull PSPDFThumbnailGridViewCell *)cell
             forIndexPath:(nonnull NSIndexPath *)indexPath;

    Swift

    func configureCell(_ cell: PSPDFThumbnailGridViewCell, for indexPath: IndexPath)
  • Returns the page for the indexPath. Override if you structure the cells differently.

    Declaration

    Objective-C

    - (NSUInteger)pageForIndexPath:(nonnull NSIndexPath *)indexPath;

    Swift

    func page(for indexPath: IndexPath) -> UInt
  • The filter segment to filter bookmarked/annotated documents.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        PSPDFThumbnailFilterSegmentedControl *filterSegment;

    Swift

    var filterSegment: PSPDFThumbnailFilterSegmentedControl? { get }
  • The filter segment is recreated on changes; to customize subclass this class and override updateFilterSegment.

    Declaration

    Objective-C

    - (void)updateFilterSegment;

    Swift

    func updateFilterSegment()
  • Used to filter the document pages. Customize to tweak page display (e.g. add sorting when in bookmark mode)

    Declaration

    Objective-C

    - (nullable NSArray<NSNumber *> *)pagesForFilter:(nonnull NSString *)filter;

    Swift

    func pages(forFilter filter: String) -> [NSNumber]?
  • Return label when there’s no content for the filter.

    Declaration

    Objective-C

    - (nullable NSString *)emptyContentLabelForFilter:(nonnull NSString *)filter;

    Swift

    func emptyContentLabel(forFilter filter: String) -> String?
  • Updates the empty view.

    Declaration

    Objective-C

    - (void)updateEmptyView;

    Swift

    func updateEmptyView()
  • Returns an instance of PSPDFCollectionReusableFilterView for the header of section 0, nil otherwise.

    Override this method if you need to customize the header in ways that UIAppearance does not support or on an instance by instance basis. If, for example, your app has instances of this class that use the sticky header and instances that don’t, you could do the following: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { PSPDFCollectionReusableFilterView *header = (id)[super collectionView:collectionView viewForSupplementaryElementOfKind:kind atIndexPath:indexPath]; if ([header isKindOfClass:PSPDFCollectionReusableFilterView.class]) { // Sticky header should have a background, regular header should not. // If you use a solid, accented background color for the sticky header, but want a seamless look for the non–sticky header this makes even more sense. header.backgroundStyle = ((PSPDFThumbnailFlowLayout *)self.collectionViewLayout).stickyHeaderEnabled ? PSPDFCollectionReusableFilterViewStyleDarkBlur : PSPDFCollectionReusableFilterViewStyleNone; // Assuming we want the filter element to sit very close to the items: header.filterElementOffset = CGPointMake(0, 10); } return header; } - see: stickyHeaderEnabled (PSPDFThumbnailFlowLayout) - see: updateInsetsForTopOverlapHeight: - see: backgroundStyle (PSPDFCollectionReusableFilterView)

    Declaration

    Objective-C

    - (UICollectionReusableView *_Nullable)
                       collectionView:(nonnull UICollectionView *)collectionView
    viewForSupplementaryElementOfKind:(nonnull NSString *)kind
                          atIndexPath:(nonnull NSIndexPath *)indexPath;

    Swift

    func collectionView(_ collectionView: Any!, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> Any!