IGGridViewDataSourceHelperLoadMoreDelegate Protocol Reference

Conforms to NSObject
Declared in IGGridViewDataSourceHelper.h

Overview

The IGGridViewDataSourceHelperLoadMoreDelegate protocol provides information to a IGGridViewDataSourceHelper regarding information about loading more rows.

If you’ve ever used an ios app where you’ve scrolled down to the bottom, and the last rows says “Load More Rows” or “Loading More Rows”, this is feature.

When a IGGridViewLoadMoreCell comes into view, the loadMoreRows: selector is raised, which tells the application that more rows need to be requested. They can the update their data source and let the the datasource helper know that more rows have been retrieved. At that point the needMoreRows: method is raised, which asks if the load more cell should be displayed anymore.

An example implementation would look something like this:

    -(IGGridViewLoadMoreCell *)cellForLoadingMore:(IGGridView *)gridView 
    {
        NSString* lookup = @"LOAD_MORE";
        IGGridViewLoadMoreCell *cell = [gridView dequeueReusableCellWithIdentifier:lookup];
        if (cell == nil) 
            cell = [[IGGridViewLoadMoreCell alloc] initWithReuseIdentifier:lookup];

        cell.textLabel.textAlignment = UITextAlignmentCenter;
        cell.textLabel.text = @"Loading More Movies...";

        return cell;
    }

    -(BOOL)needMoreRows:(IGGridViewDataSourceHelper *)dataSource
    {
        return (dataSource.data.count < 200);
    }

    -(void)loadMoreRows:(IGGridViewDataSourceHelper *)dataSource
    {
        [self makeRequestToGetMoreRows:@selector(gotMoreRows:)];
    }

    -(void)gotMoreRows:(NSArray*)newData
    {
        IGGridViewDataSourceHelper* dataSource = _gridView.dataSource;
        [dataSource appendData:newData];
        [_gridView updateData];
    }

– loadMoreRows: required method

Tells the delegate that a request has been made and it needs to load more rows.

- (void)loadMoreRows:(IGGridViewDataSourceHelper *)dataSource

Parameters

dataSource

The IGGridViewDataSourceHelper that made this call.

Declared In

IGGridViewDataSourceHelper.h

– cellForLoadingMore: required method

Provides the IGGridViewDataSourceHelper with a cell to be display to load more rows.

- (IGGridViewLoadMoreCell *)cellForLoadingMore:(IGGridView *)gridView

Parameters

gridView

The IGGridView that the cell will be displayed in.

Return Value

A IGGridViewLoadMoreCell that will be displayed to indicate that more rows are being loaded.

Declared In

IGGridViewDataSourceHelper.h

– needMoreRows: required method

Tells the delegate whether more rows are needed

- (BOOL)needMoreRows:(IGGridViewDataSourceHelper *)dataSource

Parameters

dataSource

The IGGridViewDataSourceHelper that made this call.

Return Value

Yes if more rows are needed, or NO if all the data is on the client.

Declared In

IGGridViewDataSourceHelper.h