Git Product home page Git Product logo

glyuckdatagrid's Introduction

GlyuckDataGrid

CI Status Version Quality License Platform

The GlyuckDataGrid is a custom view intended to render multicolumn tables (aka data grids, spreadsheets). Uses UICollectionView with custom UICollectionViewLayout internally.

Screenshot Screenshot

Usage

Minimum working example

import UIKit
import GlyuckDataGrid


class MultiplicationTableViewController: UIViewController, DataGridViewDataSource {
    // You can create view outlet in a Storyboard
    @IBOutlet weak var dataGridView: DataGridView!

    override func viewDidLoad() {
        super.viewDidLoad()

        //// You can also create view manually
        // dataGridView = DataGridView(frame: view.bounds)
        // view.addSubview(dataGridView)
        //// You'll need to setup constraints for just created view
        // dataGridView.setTranslatesAutoresizingMaskIntoConstraints(false)
        // view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-0.0-[dataGridView]-0.0-|", options: nil, metrics: nil, views: ["dataGridView": dataGridView]))
        // view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0.0-[dataGridView]-0.0-|", options: nil, metrics: nil, views: ["dataGridView": dataGridView]))

        // Don't forget to set dataSource and (optionally) delegate
        dataGridView.dataSource = self
        // dataGridView.delegate = self
    }

    // MARK: - DataGridViewDataSource

    // You'll need to tell number of columns in data grid view
    func numberOfColumnsInDataGridView(dataGridView: DataGridView) -> Int {
        return 9
    }

    // And number of rows
    func numberOfRowsInDataGridView(dataGridView: DataGridView) -> Int {
        return 9
    }

    // Then you'll need to provide titles for columns headers
    func dataGridView(dataGridView: DataGridView, titleForHeaderForRow row: Int) -> String {
        return String(row + 1)
    }

    // And rows headers
    func dataGridView(dataGridView: DataGridView, titleForHeaderForColumn column: Int) -> String {
        return String(column + 1)
    }

    // And for text for content cells
    func dataGridView(dataGridView: DataGridView, textForCellAtIndexPath indexPath: NSIndexPath) -> String {
        return String( (indexPath.dataGridRow + 1) * (indexPath.dataGridColumn + 1) )
    }
}

CocoaPods

To run the example project, run pod try. If you manually clone the repo, and run pod install from the Example directory first.

Installation

GlyuckDataGrid is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "GlyuckDataGrid"

Author

Vladimir Lyukov, [email protected]

glyuck.com

License

GlyuckDataGrid is available under the MIT license. See the LICENSE file for more info.

glyuckdatagrid's People

Contributors

glyuck avatar srna avatar

Watchers

James Cloos avatar Denis Murphy 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.