RBLayoutPositioner Class Reference

Inherits from NSObject
Conforms to RBThemeTrackerDelegate
Declared in RBLayoutPositioner.h

Overview

The base layout view positioner class.

  theme

The theming tracker object for the view.

@property (nonatomic, readonly, nonnull) RBThemeTracker *theme

Declared In

RBLayoutPositioner.h

  delegate

The delegate of the positioner, to receive the position invalidation event (causing a relayout).

@property (nonatomic, weak, nullable) id<RBLayoutPositionerDelegate> delegate

Declared In

RBLayoutPositioner.h

  emptyContentSize

The content size required when there are no cells in the layout view.

@property (nonatomic, readonly) CGSize emptyContentSize

Declared In

RBLayoutPositioner.h

  viewportSize

The available viewport size for the positioning the cells.

@property (nonatomic) CGSize viewportSize

Declared In

RBLayoutPositioner.h

  contentInsets

The content insets that are applied to the viewport.

@property (nonatomic) UIEdgeInsets contentInsets

Declared In

RBLayoutPositioner.h

  needsLayout

Whether or not the current result is invalid and the positioner needs to perform a layout.

@property (nonatomic, readonly) BOOL needsLayout

Declared In

RBLayoutPositioner.h

  result

The result of the last positioning operation.

@property (nonatomic, readonly, nullable) RBLayoutPositionerResult *result

Declared In

RBLayoutPositioner.h

– invalidate

Invalidates the current result, prompting a relayout.

- (void)invalidate

Declared In

RBLayoutPositioner.h

– layoutWithSizeBlock:viewCount:

Performs a layout operation, producing new frames for each cell.

- (void)layoutWithSizeBlock:(nonnull CGSize ( ^ ) ( NSUInteger index , CGSize container ))sizeBlock viewCount:(NSUInteger)viewCount

Parameters

sizeBlock

A block that can be called to get the recommended size of a cell given an available container size.

viewCount

The number of cells to position.

Declared In

RBLayoutPositioner.h

– contentSizeWithViewportSize:sizeBlock:viewCount:

Prospectively performs a layout operation to determine what content size would be required to display those cells.

- (CGSize)contentSizeWithViewportSize:(CGSize)viewportSize sizeBlock:(nonnull CGSize ( ^ ) ( NSUInteger index , CGSize container ))sizeBlock viewCount:(NSUInteger)viewCount

Parameters

viewportSize

The available viewport size.

sizeBlock

A block that can be called to get the recommended size of a cell given an available container size.

viewCount

The number of cells to position.

Return Value

The resulting content size.

Declared In

RBLayoutPositioner.h

  spacing

The spacing between cells in the positioner. A positioner should attempt to respect this as much as is possible. Depending on the positioner it may be ignored e.g. RBLayoutFlexiPositioner.

@property (nonatomic) CGFloat spacing

Declared In

RBLayoutPositioner.h

  margin

The margin that should be provided around the collective cell bounds.

@property (nonatomic) UIEdgeInsets margin

Declared In

RBLayoutPositioner.h

  minimumSize

The minimum size that the layout view will size to when sizeThatFits: is called.

@property (nonatomic) CGSize minimumSize

Declared In

RBLayoutPositioner.h

  maximumSize

The maximum size that the layout view will size to when sizeThatFits: is called. Note this is particularly useful when you have multiple embedded RBLayoutViews that have expanding positioners (e.g. RBLayoutGridPositioner). These in specific configurations attempt to expand the cell size and layout to consume all available space and as a viewport of 1000000 maybe passed to the embedded RBLayoutView it may need to be restricted via the maximumSize property.

@property (nonatomic) CGSize maximumSize

Declared In

RBLayoutPositioner.h

– shouldInvalidateDueToContentInsetsChangeFrom:to:

Whether or not the given change of the content insets should invalidate the layout, causing a repositioning.

- (BOOL)shouldInvalidateDueToContentInsetsChangeFrom:(UIEdgeInsets)fromContentInsets to:(UIEdgeInsets)contentInsets

Parameters

fromContentInsets

The original content insets.

contentInsets

The new content insets.

Return Value

Whether or not the layout should be invalidated.

Declared In

RBLayoutPositioner.h

– calculateWithViewportSize:sizeBlock:viewCount:

Performs a recalculation of the layout.

- (nonnull RBLayoutPositionerResult *)calculateWithViewportSize:(CGSize)viewportSize sizeBlock:(nonnull CGSize ( ^ ) ( NSUInteger index , CGSize container ))sizeBlock viewCount:(NSUInteger)viewCount

Parameters

viewportSize

The available size of the viewport.

sizeBlock

A block that can be called to get the recommended size of a cell given an available container size.

viewCount

The number of cells to position.

Return Value

The result of the recalculation of the layout.

Declared In

RBLayoutPositioner.h