PSPDFThumbnailFlowLayout

Objective-C


@interface PSPDFThumbnailFlowLayout : UICollectionViewLayout

Swift

class ThumbnailFlowLayout : 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 true.

  • 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 (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 (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 (nonatomic) CGFloat lineSpacing;

    Swift

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

    Defaults to false.

    Note

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

    Declaration

    Objective-C

    @property (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 (nonatomic) PSPDFThumbnailFlowLayoutLineAlignment incompleteLineAlignment;

    Swift

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

    When setting this property to true, 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:.

    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

    collectionView:viewForSupplementaryElementOfKind:atIndexPath:

    See

    backgroundStyle (PSPDFCollectionReusableFilterView)

    Declaration

    Objective-C

    @property (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 (nonatomic) BOOL flipsLayoutDirection;

    Swift

    var flipsLayoutDirection: Bool { get set }
  • Call this method when the layout delegate page mode property changes and the layout should take the new page mode value into account.

    Note

    While invalidateLayout handles the general invalidation of the layout and might decide to still use cached results, this method handles page mode changes specifically and forces the layout to reload all item positions and sizes.

    Declaration

    Objective-C

    - (void)invalidateLayoutWithPageModeChange;

    Swift

    func invalidateLayoutWithPageModeChange()