Conforms to NSObject
Declared in IGFlowLayoutView.h

Overview

The IGFlowLayoutViewDataSource protocol is adopted by an object that mediates the application’s data model for a IGFlowLayoutView object. The data source provides the flow layout view object with the information it needs to construct and modify a flow layout view.

Instance Methods

flowLayoutView:cellAtIndex:

Asks the dataSource for IGFlowLayoutViewCell that is about to be displayed in the flowLayoutView. (required)

- (IGFlowLayoutViewCell *)flowLayoutView:(IGFlowLayoutView *)flowLayoutView cellAtIndex:(NSInteger)index

Parameters

flowLayoutView

The flowLayouView requestiong the information.

index

The index of a particular item that will be displayed in the flowLayoutView.

Return Value

The visible representation of an item that will be displayed in the flowLayoutView.

Declared In

IGFlowLayoutView.h

flowLayoutView:itemAtIndexDraggable:

Asks the dataSource if particular item can be dragged.

- (BOOL)flowLayoutView:(IGFlowLayoutView *)flowLayoutView itemAtIndexDraggable:(NSInteger)index

Parameters

flowLayoutView

The flowLayouView requestiong the information.

index

The index of a particular item in the flowLayoutView

Return Value

Yes if the item can be dragged.

Declared In

IGFlowLayoutView.h

flowLayoutView:itemAtIndexResizable:

Asks the dataSource if particular item can be resized.

- (BOOL)flowLayoutView:(IGFlowLayoutView *)flowLayoutView itemAtIndexResizable:(NSInteger)index

Parameters

flowLayoutView

The flowLayouView requestiong the information.

index

The index of a particular item in the flowLayoutView

Return Value

Yes if the item can be resized.

Declared In

IGFlowLayoutView.h

flowLayoutView:moveItemAtIndex:toIndex:

Tells the dataSource an item is about to be moved to a new index.

- (NSInteger)flowLayoutView:(IGFlowLayoutView *)flowLayoutView moveItemAtIndex:(NSInteger)index toIndex:(NSInteger)newIndex

Parameters

flowLayoutView

The flowLayouView requestiong the information.

index

The original index of a particular item in the flowLayoutView

newIndex

The new proposed index of a particular item in the flowLayoutView

Return Value

The index the item should be moved to. Or the newIndex if you’re not restricting it.

Discussion

This method must be implemented in order to support user interactive reordering.

The underlying data should then be updated, or if you do not want to be moved to the new index, or would prefer another index, you should return that preferred index.

Declared In

IGFlowLayoutView.h

flowLayoutView:newSize:forItemAtIndex:

Tells the dataSource an item is about to be reszied

- (CGSize)flowLayoutView:(IGFlowLayoutView *)flowLayoutView newSize:(CGSize)size forItemAtIndex:(NSInteger)index

Parameters

flowLayoutView

The flowLayouView requestiong the information.

size

The new proposed size for the specified item.

index

The index of a particular item in the flowLayoutView

Return Value

The size the item should be resized to. Or the newSize if you’re not restricting it.

Discussion

This method must be implemented in order to support user interactive resizing.

The underlying data should then be updated, or if you do not want to be resized, or would prefer another size, you should return that preferred size.

Declared In

IGFlowLayoutView.h

flowLayoutView:sizeForItemAtIndex:

Asks the dataSource for the number of blocks both vertical and horizontal that a particular item will use. (required)

- (CGSize)flowLayoutView:(IGFlowLayoutView *)flowLayoutView sizeForItemAtIndex:(NSInteger)index

Parameters

flowLayoutView

The flowLayouView requestiong the information.

index

The index of a particular item that will be displayed in the flowLayoutView.

Return Value

The relative number of blocks that a particular item will use.

Discussion

Blocks are a relative size, and will be limited by the size returned in numberOfBlocksInViewport: If you want an item to always take the maximum number of vertical or horizontal blocks for the viewport, you can set the width or height to INFINITY.

Declared In

IGFlowLayoutView.h

numberOfBlocksInViewport:

Asks the dataSource for the number of blocks both vertical and horizontal that will fit within the viewport of the flowLayoutView. (required)

- (CGSize)numberOfBlocksInViewport:(IGFlowLayoutView *)flowLayoutView

Parameters

flowLayoutView

The flowLayouView requestiong the information.

Return Value

The relative number of blocks that will fit in the viewport.

Discussion

Blocks are a relative size. For example if your flowLayoutView’s frame was 500x500 and you returned a size of 2x5 Then there would be 2 horizontal block each one having a width of 250 pts and there would be 5 vertical blocks each having a height of 100 pts. If the FlowLayoutView was then resized to be 200x200, the size of the blocks would also resize, however the number of blocks would not change.

Declared In

IGFlowLayoutView.h

numberOfItemsInFlowLayoutView:

Asks the dataSource for the total number of items that will be displayed in the flow layout view. (required)

- (NSInteger)numberOfItemsInFlowLayoutView:(IGFlowLayoutView *)flowLayoutView

Parameters

flowLayoutView

The flowLayouView requestiong the information.

Return Value

The total number of items that will be displayed.

Discussion

For example, if you had an array of objects that you wanted displayed, then you return that array’s count in this method.

Declared In

IGFlowLayoutView.h