- Notifications
You must be signed in to change notification settings - Fork58
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.
License
keshiim/ZMJGanttChart
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Full configurable sheet view user interfaces for iOS applications. With this framework,you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.
- Fixed column and row headers
- Merge cells
- Circular infinite scrolling automatically
- Customize gridlines and borders for each cell
- Customize inter cell spacing vertically and horizontally
- Fast scrolling, memory efficient
UICollectionViewlike API- Well unit tested
Find the above displayed 4 examples in theExamples folder.
To run the example project, clone the repo, and runpod install from the Example directory first.
SpreadsheetView is written in Objective-c 2.0 Compatible with iOS 8.0+
ZMJGanttChart is available throughCocoaPods. To installit, simply add the following line to your Podfile:
pod'ZMJGanttChart'
The minimum requirement is connecting a data source to return the number of columns/rows, and each column width/row height.
#import<UIKit/UIKit.h>#import<ZMJGanttChart/ZMJGanttChart.h>@interfaceViewController () <SpreadsheetViewDelegate, SpreadsheetViewDataSource>@property (nonatomic,strong) SpreadsheetView *spreadsheetView;@end@implementationViewController- (void)viewDidLoad { [superviewDidLoad]; self.spreadsheetView.delegate = self; self.spreadsheetView.dataSource = self;}- (void)viewDidAppear:(BOOL)animated { [superviewDidAppear:animated]; [self.spreadsheetViewflashScrollIndicators];}- (void)viewWillLayoutSubviews { [superviewWillLayoutSubviews];if (@available(iOS11.0, *)) { self.spreadsheetView.frame = self.view.safeAreaLayoutGuide.layoutFrame; }else {//Fallback on earlier version self.spreadsheetView.frame = self.view.bounds; }}#pragma mark - getters- (SpreadsheetView *)spreadsheetView {if (!_spreadsheetView) { _spreadsheetView = ({ SpreadsheetView *ssv = [SpreadsheetViewnew]; ssv.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.viewaddSubview:ssv]; ssv; }); }return _spreadsheetView;}// MARK: DataSource- (NSInteger)numberOfColumns:(SpreadsheetView *)spreadsheetView {return10;}- (NSInteger)numberOfRows:(SpreadsheetView *)spreadsheetView {return20;}- (CGFloat)spreadsheetView:(SpreadsheetView *)spreadsheetViewwidthForColumn:(NSInteger)column {return120.f;}- (CGFloat)spreadsheetView:(SpreadsheetView *)spreadsheetViewheightForRow:(NSInteger)row {return40;}@end
Freezing a column or row behaves as a fixed column/row header.
- (NSInteger)frozenColumns:(SpreadsheetView *)spreadsheetView {return2;}
- (NSInteger)frozenRows:(SpreadsheetView *)spreadsheetView {return2;}
- (NSInteger)frozenColumns:(SpreadsheetView *)spreadsheetView {return2;}- (NSInteger)frozenRows:(SpreadsheetView *)spreadsheetView {return2;}
Multiple cells can be merged and then they are treated as one cell. It is used for grouping cells.
- (NSArray<ZMJCellRange *> *)mergedCells:(SpreadsheetView *)spreadsheetView {return @[ [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:1column:1]to:[LocationlocationWithRow:3column:2]]], [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:3column:3]to:[LocationlocationWithRow:8column:3]]], [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:4column:0]to:[LocationlocationWithRow:7column:2]]], [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:2column:4]to:[LocationlocationWithRow:5column:8]]], [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:9column:0]to:[LocationlocationWithRow:10column:5]]], [ZMJCellRangecellRangeFrom:[LocationlocationWithRow:11column:2]to:[LocationlocationWithRow:12column:4]]], ];}
Your table acquires infinite scroll just setcircularScrolling property.
spreadsheetView.circularScrolling = [Configurationinstance].horizontally;spreadsheetView.circularScrolling = [Configurationinstance].vertically;spreadsheetView.circularScrolling = [Configurationinstance].bothIf circular scrolling is enabled, you can set additional parameters that the option not to repeat column/row header and to extend column/row header to the left/top edges.CircularScrolling.Configuration is a builder pattern, can easily select the appropriate combination by chaining properties.
e.g.
spreadsheetView.circularScrolling = [CircularScrollingConfigurationBuilderconfigurationBuilderWithCircularScrollingState:ZMJCircularScrolling_horizontally_columnHeaderNotRepeated];spreadsheetView.circularScrolling = [CircularScrollingConfigurationBuilderconfigurationBuilderWithCircularScrollingState:ZMJCircularScrolling_both_columnHeaderStartsFirstRow;You can customize the appearance of grid lines and borders of the cell. You can specify whether a cell has a grid line or border. Grid lines and borders can be displayed on the left, right, top, or bottom, or around all four sides of the cell.
The difference between gridlines and borders is that the gridlines are drawn at the center of the inter-cell spacing, but the borders are drawn to fit around the cell.
spreadsheetView.intercellSpacing = CGSizeMake(1,1);
SpreadsheetView'sgridStyle property is applied to the entire table.
spreadsheetView.gridStyle = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorlightGray]];
You can set differentgridStyle for each cell and each side of the cell. If you set cell'sgridStyle property to default,SpreadsheetView's gridStyle property will be applied. Specifynone means the grid will not be drawn.
cell.gridlines.top = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorblue]];cell.gridlines.left = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorblue]];cell.gridlines.bottom= [GridStyleborderStyleNone];cell.gridlines.right = [GridStyleborderStyleNone];
You can set differentborderStyle for each cell as well.
cell.borders.top = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorred]];cell.borders.left = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorred]];cell.borders.bottom= [GridStylestyle:GridStyle_solidwidth:1color:[UIColorred]];cell.borders.right = [GridStylestyle:GridStyle_solidwidth:1color:[UIColorred]];
keshiim,keshiim@163.com
ZMJGanttChart is available under the MIT license. See the LICENSE file for more info.
About
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.











