PKColumnTable 2.0

PKColumnTable 2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2018
SPMSupports SPM

Maintained by Prateek kansara.




  • By
  • kansaraprateek

PKColumnTable

CI Status Version License Platform

Example

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

Screenshots

Requirements

Installation

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

pod "PKColumnTable"
import PKColumnTable

// Either set UIView as PKColumnTable in storyboard or create a object and add as subview.

var columnExample = PKColumnTable(frame : CGRect(x:0,y:0,width:200,height:200))

Table Data

Create 2-D array to insert data at required rows of colum. For eg

let tableData = [["1", "2", "3"],
["4", "5", "6"],
["7", "8", "9"],
["10", "12", "13"],
["14", "24", "34"],
]

Setting Column

Column width array is in reference to frame size.

columnExample.setTableColumnTitles(titles: ["Column 1", "Column 2", "Column 3"], data: tableData as NSArray, columnWidths: [0.3, 0.3 , 0.4], isFloatingHeader: true)

To get response on table row clicked set columnExample delegate to current viewcontroller-

columnExample.delegate = self

And override method -

    didSelectRow(atIndex : IndexPath)

Manage UI

columnExample.setupTableUI(data: [kPKTableBKG:UIColor.red, kPKTableCellBackgroundColor: UIColor.red])
  • Need to set table UI method before calling setTableColumnTitles(titles:data:columnWidths:isFloatingHeader:)

Apart from these you can use different UI keys -

// Header UI Keys kPKTableColumnTitleFont kPKTableColumnTitleColor kPKTableColumnTitleAlignment kPKTableColumnTextViewBkg kPKHeaderBKG

// Cell UI Keys kPKTableCellTextAlignment kPKTableCellTextColor kPKTableCellRowTextFont kPKTableCellBackgroundColor kPKTableCellTextViewBkg

// Table/scrollview/view background kPKTableBKG kPKScrollBKG kPKViewBKG

Author

kansaraprateek, [email protected]

License

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