Latest 0.2.2
Homepage https://github.com/kanaishinichi/TAXSpreadSheet
License MIT
Platforms ios 6.0, requires ARC
Authors

A view that display cells like spreadsheet.

TAXSpreadSheet_SC_1

Requirements

iOS 6.0 or later

Installation

via CocoaPods

pod 'TAXSpreadSheet'

Usage

Import header

#import "TAXSpreadSheet.h"

Instantiate TAXSpreadSheet and register UICollectionViewCell or subclass for cells the same as UICollectionView.

TAXSpreadSheet *spreadSheet = [[TAXSpreadSheet alloc] initWithFrame:CGRectMake(0.0. 0.0. 100.0, 100.0)];
[spreadSheet registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];

Set DataSource and Delegate objects and implement those methods.

- (NSUInteger)numberOfColumnsInSpreadSheet:(TAXSpreadSheet *)spreadSheet
{
    return 10;
}

- (NSUInteger)numberOfRowsInSpreadSheet:(TAXSpreadSheet *)spreadSheet
{
    return 20;
}

- (UICollectionViewCell *)spreadSheet:(TAXSpreadSheet *)spreadSheet cellAtRow:(NSUInteger)row column:(NSUInteger)column
{
    UICollectionViewCell *cell = [spreadSheet dequeueReusableCellWithReuseIdentifier:@"Cell" forRow:row column:column];

    // Customize cells.

    return cell;
}

You should return dequeued UICollectionViewCell subclass from SpreadSheet in spreadSheet:cellAtRow:column

Customize

Specifying individual metrics

You can specify individual heights of row, width of column, inter-row/column spacing by implementing delegate methods.
In case of using default value, return NSNotFound.

- (CGFloat)spreadSheet:(TAXSpreadSheet *)spreadSheet heightAtRow:(NSUInteger)row
{
    if (row == 0) {
        return 100.0;
    } else {
        return 50.0;
    }
}

Use custom views for inter-row/column.

You can use custom UICollectionReusableView subclass for inter-row/column by implementing delegate methods.
You should register class and dequeue view from SpreadSheet.
In case of not using view, return nil.

- (UICollectionReusableView *)spreadSheet:(TAXSpreadSheet *)spreadSheet interRowViewBelowRow:(NSUInteger)row
{
    if (row == 0) {
        UICollectionReusableView *view = [spreadSheet dequeueReusableInterRowViewWithIdentifier:@"View" belowRow:row];
        return view;
    } else {
        return nil;
    }
}

License

MIT License

Change Log

0.2.0

  • [Add] UICollectionView/Layout compatible methods.
  • [Add] Forwarding UICollectionViewDelegate methods.
  • [Add] backgoundView property.
  • [Fix] backgroundColor property.

0.2.1

  • [Fix] Crash when number of rows or columns become zero.

Latest podspec

{
    "name": "TAXSpreadSheet",
    "version": "0.2.2",
    "summary": "A view that display cells like spreadsheet.",
    "homepage": "https://github.com/kanaishinichi/TAXSpreadSheet",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "ShinichiKanai": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/kanaishinichi/TAXSpreadSheet.git",
        "tag": "0.2.2"
    },
    "source_files": "TAXSpreadSheet/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This