GithubHelp home page GithubHelp logo

taxheadersheet's Introduction

TAXHeaderSheet

A spreadsheet view that have header/footer

TAXHeaderSheet_SC_1

##Requirements

iOS 6.0 or later

##Dependency

TAXSpreadSheet 0.2.0 or later

##Installation via CocoaPods

pod 'TAXHeaderSheet'

##Usage

Import header

#import "TAXHeaderSheet.h"

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

TAXHeaderSheet *headerSheet = [[TAXHeaderSheet alloc] initWithFrame:CGRectMake(0.0. 0.0. 100.0, 100.0)];
[headerSheet registerClass:[UICollectionViewCell class] forCellInAllSectionWithReuseIdentifier:@"Cell"];

Set metrics of the sheet via properties.

headerSheet.numberOfRowsOfBody = 30;
headerSheet.numberOfColumnsOfBody = 20;

headerSheet.numberOfRowsOfHeader = 1;
headerSheet.numberOfRowsOfFooter = 2;
headerSheet.numberOfColumnsOfHeader = 1;
headerSheet.numberOfColumnsOfFooter = 1;

headerSheet.sizeForCell = CGSizeMake(50.0, 20.0);
headerSheet.widthOfHeaderCell = 50.0;
headerSheet.widthOfFooterCell = 50.0;
headerSheet.heightOfHeaderCell = 20.0;
headerSheet.heightOfFooterCell = 20.0;
    
headerSheet.heightOfHeader = headerSheet.heightOfHeaderCell * 
headerSheet.numberOfRowsOfHeader;
headerSheet.heightOfFooter = headerSheet.heightOfFooterCell * headerSheet.numberOfRowsOfFooter;
headerSheet.widthOfHeader = headerSheet.widthOfHeaderCell * headerSheet.numberOfColumnsOfHeader;
headerSheet.widthOfFooter = headerSheet.widthOfFooterCell * headerSheet.numberOfColumnsOfFooter;

or by implementing delegate methods eg. headerSheet:heightAtRow:ofSectionType: There is priority for cell height/width: Header > Footer > Body > Property.

Set DataSource and Delegate objects and implement those methods.

- (UICollectionViewCell*)headerSheet:(TAXHeaderSheet *)headerSheet cellAtRow:(NSUInteger)row column:(NSUInteger)column inSectionType:(TAXHeaderSheetSectionType)sectionType
{
    TAXLabelCell *cell = [headerSheet dequeueReusableCellInSectionType:sectionType withReuseIdentifier:CellIdentifier forRow:row column:column];
    // Customize cell.
    return cell;
}

You should return dequeued UICollectionViewCell subclass in headerSheet:cellAtRow:column:inSectionType

##Customize

###Use custom views for separators.

You can use custom UICollectionReusableView subclass for separators. You should register class and dequeue view from HeaderSheet. In case of not using view, return nil.

- (UICollectionReusableView *)headerSheet:(TAXHeaderSheet *)headerSheet separatorViewOfSeparatorType:(TAXHeaderSheetSeparatorType)separatorType
{
    UICollectionReusableView *view = [headerSheet dequeueReusableSeparatorViewOfSeparatorType:separatorType withReuseIdentifier:@"Separator"];
    view.backgroundColor = [UIColor blueColor];
    return view;
}

###Use custom views for inter-row/column of each section.

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 *)headerSheet:(TAXHeaderSheet *)headerSheet interRowViewInSectionType:(TAXHeaderSheetSectionType)sectionType belowRow:(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] Methods for inserting, moving, deleting rows/columns.
  • [Add] Methods for setting background color/view.

###0.3.0

  • [Add] Feature of scrolling in touching any section.
  • [Add] TAXHeaderSheetHorizontal/VerticalSectionType

taxheadersheet's People

Contributors

kanaishinichi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.