PSPDFThumbnailViewController


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

The thumbnail view controller.

  • 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

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

    Swift

    func page(for indexPath: IndexPath) -> PageIndex
  • The segmented control shown at the top, which can be used to filter to only show bookmarked or annotated pages.

    Declaration

    Objective-C

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

    Swift

    var filterSegment: PSPDFThumbnailFilterSegmentedControl? { get }
  • The filter segmented control 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 PSPDFThumbnailViewFilter)filter;

    Swift

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

    Declaration

    Objective-C

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

    Swift

    func emptyContentLabel(forFilter filter: PSPDFThumbnailViewFilter) -> 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!