RBLazyLayoutViewDataSource Protocol Reference

Conforms to NSObject
Declared in RBLazyLayoutView.h

Overview

The data source that provides cells to a RBLazyLayoutView.

– countForLayoutView: required method

Gets the number of cells to be displayed in the layout view.

- (NSUInteger)countForLayoutView:(nonnull RBLazyLayoutView *)layoutView

Parameters

layoutView

The layout view object.

Return Value

The number of cells.

Discussion

Gets the number of cells to be displayed in the layout view.

Declared In

RBLazyLayoutView.h

– cellSizeAtIndex:withContainer:forLayoutView: required method

Gets the desired size of the cell at the given index, with the available container size provided.

- (CGSize)cellSizeAtIndex:(NSUInteger)index withContainer:(CGSize)container forLayoutView:(nonnull RBLazyLayoutView *)layoutView

Parameters

index

The index of the cell to size.

container

The available size for the cell in it’s container.

layoutView

The layout view object.

Return Value

The desired size of the cell.

Discussion

Gets the desired size of the cell at the given index, with the available container size provided.

Declared In

RBLazyLayoutView.h

– cellAtIndex:forLayoutView: required method

Gets the cell to be presented in the layout view at the given index. The reusableCellWithType:configurationOnCreation: or reusableCellWithType:shouldApplyTheming:configurationOnCreation methods should be used. The first is a convienance method that passes YES as the the shouldApplyTheming parameter to the second.

- (nonnull __kindof UIView *)cellAtIndex:(NSUInteger)index forLayoutView:(nonnull RBLazyLayoutView *)layoutView

Parameters

index

The index of the cell.

layoutView

The layout view object.

Return Value

The prepared cell.

Discussion

Gets the cell to be presented in the layout view at the given index. The reusableCellWithType:configurationOnCreation: or reusableCellWithType:shouldApplyTheming:configurationOnCreation methods should be used. The first is a convienance method that passes YES as the the shouldApplyTheming parameter to the second.

Declared In

RBLazyLayoutView.h

– layoutView:willRemoveCell:atIndex:

Called when a cell will be removed from the layout view and stored for reuse at a later stage. Use this to stop any image download jobs, etc.

- (void)layoutView:(nonnull RBLazyLayoutView *)layoutView willRemoveCell:(nonnull __kindof UIView *)cell atIndex:(NSUInteger)index

Parameters

layoutView

The layout view object.

cell

The cell that is being removed.

index

The index of the cell.

Discussion

Called when a cell will be removed from the layout view and stored for reuse at a later stage. Use this to stop any image download jobs, etc.

Declared In

RBLazyLayoutView.h