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.

    When setting this property to YES, you should also take care of customizing the section header such that it has a visible background. You can do so either by setting the backgroundColor or backgroundStyle of the appearance of PSPDFCollectionReusableFilterView or—if you need finer grained control—by overriding -collectionView:viewForSupplementaryElementOfKind:atIndexPath:.

    When stickyHeaderEnabled is set to YES, updateInsetsForTopOverlapHeight: method adjusts the collection view’s scrollIndicatorInsets such that the vertical scroll indicator does not overlap the header. This makes sense because the scrollable content area no longer includes the header, but it will look weird if you don’t give the header a background.

    See

    updateInsetsForTopOverlapHeight:

    See

    collectionView:viewForSupplementaryElementOfKind:atIndexPath:

    See

    backgroundStyle (PSPDFCollectionReusableFilterView)

    Declaration

    Objective-C

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

    Swift

    var stickyHeaderEnabled: Bool { get set }
  • Controls whether the layout is in a left to right orientation or if the layout should flip its horizontal axis and calculate its items’ position in a right to left manner.

    Declaration

    Objective-C

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

    Swift

    var flipsLayoutDirection: Bool { get set }