Conforms to NSObject
Declared in SMGridView.h

Overview

Implement this protocol to provide an SMGridView with data to create the views.

Tasks

Instance Methods

numberOfSectionsInSMGridView:

Implement this method if your SMGridView has more than 1 section. No need to implement if it only has 1 section

- (NSInteger)numberOfSectionsInSMGridView:(SMGridView *)gridView

Parameters

gridView

The calling SMGridView

Return Value

The number of sections in the grid

Declared In

SMGridView.h

smGridView:canMoveItemAtIndexPath:

Implement this method in combination with property [SMGridView enableSort] to be able to move items

- (BOOL)smGridView:(SMGridView *)gridView canMoveItemAtIndexPath:(NSIndexPath *)indexPath

Parameters

gridView

The calling SMGridView

indexPath

The indexPath of the item that is about to be dragged

Return Value

YES if an item at the given indexPath can be moved.

Declared In

SMGridView.h

smGridView:numberOfItemsInSection:

Number of items in a section

- (NSInteger)smGridView:(SMGridView *)gridView numberOfItemsInSection:(NSInteger)section

Parameters

gridView

The calling SMGridView

section

The asked section

Return Value

Number of items in a section

Declared In

SMGridView.h

smGridView:numberOfRowsInSection:

Use this method if your sections contain different number of rows. Otherwise you can use numberOfRows property

- (NSInteger)smGridView:(SMGridView *)gridView numberOfRowsInSection:(NSInteger)section

Parameters

gridView

The calling SMGridView

section

The target section

Return Value

number of rows in a section

Declared In

SMGridView.h

smGridView:performRemoveIndexPath:

This method will be called when a remove animation is finished. SMGridViewDataSource should remove the item at indexPath position in the implementation of this method

- (void)smGridView:(SMGridView *)gridView performRemoveIndexPath:(NSIndexPath *)indexPath

Parameters

gridView

The calling SMGridView

indexPath

The indexPath to delete

Declared In

SMGridView.h

smGridView:shouldMoveItemFrom:to:

This method will be called when the user sorts the grid. DataSource should update its data accordingly

- (void)smGridView:(SMGridView *)gridView shouldMoveItemFrom:(NSIndexPath *)fromIndexPath to:(NSIndexPath *)toIndexPath

Parameters

gridView

The calling SMGridView

fromIndexPath

The original indexPath

toIndexPath

The new indexPath

Declared In

SMGridView.h

smGridView:sizeForHeaderInSection:

Implement this method if you want to have header views for your section

- (CGSize)smGridView:(SMGridView *)gridView sizeForHeaderInSection:(NSInteger)section

Parameters

gridView

The calling SMGridView

section

The target section

Return Value

The size of the header in the given section. Return CGSizeZero if no header

Declared In

SMGridView.h

smGridView:sizeForIndexPath:

Size of a view in a given indexPath

- (CGSize)smGridView:(SMGridView *)gridView sizeForIndexPath:(NSIndexPath *)indexPath

Parameters

gridView

The calling SMGridView

indexPath

The target indexPath

Return Value

Size of a view in a given indexPath

Declared In

SMGridView.h

smGridView:viewForHeaderInSection:

Implement this method if you want to have header views for your section

- (UIView *)smGridView:(SMGridView *)gridView viewForHeaderInSection:(NSInteger)section

Parameters

gridView

The calling SMGridView

section

The target section

Return Value

The header view for a given section. Return nil if no header.

Declared In

SMGridView.h

smGridView:viewForIndexPath:

You should use dequeReusableView or dequeReusableViewWithClass: inside this method for better performance

- (UIView *)smGridView:(SMGridView *)gridView viewForIndexPath:(NSIndexPath *)indexPath

Parameters

gridView

The calling SMGridView

indexPath

The target indexPath

Return Value

Size of a view in a given indexPath

Declared In

SMGridView.h

smGridView:willQueueView:

This is being called whenever a view is queued. Use this to stop animations, clean…

- (void)smGridView:(SMGridView *)gridView willQueueView:(UIView *)view

Parameters

gridView

The calling SMGridView

view

The view that is about to be queued

Declared In

SMGridView.h

smGridViewSameSize:

Return yes in this method if all your views have the same size. This will have a big improvement in performance

- (BOOL)smGridViewSameSize:(SMGridView *)gridView

Parameters

gridView

The calling SMGridView

Declared In

SMGridView.h

smGridViewShowLoader:

Use this method to decide wether to show a loader or not. Typically you make your SMGridViewDataSource manage this method and returning YESor NO if it is loading more content.

- (BOOL)smGridViewShowLoader:(SMGridView *)gridView

Parameters

gridView

The calling SMGridView

Return Value

Wether to show or not the loader

Declared In

SMGridView.h