Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

keshiim/ZMJGanttChart

Repository files navigation

CI StatusVersionLicensePlatform

Introduce

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.

  
  

Features

  • 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
  • UICollectionView like API
  • Well unit tested

Find the above displayed 4 examples in theExamples folder.

Example

To run the example project, clone the repo, and runpod install from the Example directory first.

Requirements

SpreadsheetView is written in Objective-c 2.0 Compatible with iOS 8.0+

Installation

ZMJGanttChart is available throughCocoaPods. To installit, simply add the following line to your Podfile:

pod'ZMJGanttChart'

Getting Started

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

Usage

Freeze column and row headers

Freezing a column or row behaves as a fixed column/row header.

Column Header

- (NSInteger)frozenColumns:(SpreadsheetView *)spreadsheetView {return2;}

Row Header

- (NSInteger)frozenRows:(SpreadsheetView *)spreadsheetView {return2;}

both

- (NSInteger)frozenColumns:(SpreadsheetView *)spreadsheetView {return2;}- (NSInteger)frozenRows:(SpreadsheetView *)spreadsheetView {return2;}

Merge cells

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]]],    ];}

Circular Scrolling

Your table acquires infinite scroll just setcircularScrolling property.

Enable horizontal circular scrolling

spreadsheetView.circularScrolling = [Configurationinstance].horizontally;

Enable vertical circular scrolling

spreadsheetView.circularScrolling = [Configurationinstance].vertically;

Both

spreadsheetView.circularScrolling = [Configurationinstance].both

If 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;

Customize gridlines, borders and cell spacing

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.

Cell spacing

spreadsheetView.intercellSpacing = CGSizeMake(1,1);

Gridlines

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];

Border

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]];

Author

keshiim,keshiim@163.com

License

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

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp