CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2015 |
Maintained by ShinichiKanai.
A view that display cells like spreadsheet.
iOS 6.0 or later
via CocoaPods
pod 'TAXSpreadSheet'
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
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;
}
}
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;
}
}
MIT License