PSPDFThumbnailFlowLayout


@interface PSPDFThumbnailFlowLayout : UICollectionViewLayout

A layout similar to UICollectionViewFlowLayout with support for sticky headers and double-page spreads, as you’d use it for the thumbnails of a magazine.

Note

This layout only supports a single section. Using multiple sections is unsupported and may result in undefined behavior.

Note

This layout only supports a very limited horizontal scrolling mode which you can enable by setting the singleLineMode property to YES.

  • The insets used to lay out content in a section

    The section insets effects the positioning of the items inisde a section. It does not effect the positioning of the section header in any direction. Instead the top section inset controls the spacing between the section header and the first line of items in that section.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets sectionInset;

    Swift

    var sectionInset: UIEdgeInsets { get set }
  • The inter item spacing controls the spacing between items in horizontal direction.

    Defaults to 10.0

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat interitemSpacing;

    Swift

    var interitemSpacing: CGFloat { get set }
  • The line spacing controllers the spacing between items in vertical direction.

    Defaults to 10.0

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat lineSpacing;

    Swift

    var lineSpacing: CGFloat { get set }
  • If the layout should horizontally position its items in one line, set this value to YES.

    Defaults to NO.

    Note

    In single line mode headers are not supported and will result in an exception.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL singleLineMode;

    Swift

    var singleLineMode: Bool { get set }
  • Specifies how an incomplete lines (i.e. the last line when it has less items than the previous lines) in the layout are aligned.

    Defaults to PSPDFThumbnailFlowLayoutLineAlignmentLeft

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        PSPDFThumbnailFlowLayoutLineAlignment incompleteLineAlignment;

    Swift

    var incompleteLineAlignment: PSPDFThumbnailFlowLayoutLineAlignment { get set }
  • Controls whether a section header should always stick to the top of the screen or not.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL stickyHeaderEnabled;

    Swift

    var stickyHeaderEnabled: Bool { get set }
  • Disables double page mode, when NO, it will just follow the presentationContext. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL doublePageModeDisabled;

    Swift

    var doublePageModeDisabled: Bool { get set }
  • Returns YES if the current layout uses double page mode.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL doublePageMode;

    Swift

    var doublePageMode: Bool { get }
  • We use this object to figure out if we want to use the double page mode and how to use it

    Declaration

    Objective-C

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

    Swift

    weak var presentationContext: PSPDFPresentationContext? { get set }
  • Returns the attributes type for the specified index path.

    Declaration

    Objective-C

    - (PSPDFThumbnailFlowLayoutAttributesType)
       typeForIndexPath:(nonnull NSIndexPath *)indexPath
    usingDoublePageMode:(BOOL)usingDoublePageMode;

    Swift

    func type(for indexPath: IndexPath, usingDoublePageMode: Bool) -> PSPDFThumbnailFlowLayoutAttributesType
  • Returns the index path for the other page in a double page, or nil if the type is single.

    Declaration

    Objective-C

    - (nullable NSIndexPath *)indexPathForDoublePage:
        (nonnull NSIndexPath *)indexPath;

    Swift

    func indexPath(forDoublePage indexPath: IndexPath) -> IndexPath?