https://github.com/pujiaxin33/jxexcel
一个轻量级的表视图
https://github.com/pujiaxin33/jxexcel
excel table tablelist
Last synced: about 1 year ago
JSON representation
一个轻量级的表视图
- Host: GitHub
- URL: https://github.com/pujiaxin33/jxexcel
- Owner: pujiaxin33
- License: mit
- Created: 2019-09-18T10:14:29.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T01:56:07.000Z (over 6 years ago)
- Last Synced: 2025-03-29T10:22:14.662Z (over 1 year ago)
- Topics: excel, table, tablelist
- Language: Swift
- Homepage:
- Size: 18.6 KB
- Stars: 36
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JXExcel
A lightweight table view,like Excel!
# Preview

# Requirements
- iOS 9.0+
- XCode 10.2.1+
- Swift 5.0+
# Install
## CocoaPods
```ruby
Target '' do
Pod 'JXExcel'
End
```
Execute `pod repo update` first, then execute `pod install`
# Usage
## init `ExcelView`
```Swift
excel = ExcelView(frame: CGRect.zero)
excel.dataSource = self
excel.delegate = self
view.addSubview(excel)
```
## implement `ExcelViewDataSource`
```Swift
func numberOfRows(in excelView: ExcelView) -> Int {
return 50
}
func numberOfColumns(in excelView: ExcelView) -> Int {
return 10
}
func excelView(_ excelView: ExcelView, columnNameAt column: Int) -> String {
return "col:\(column)"
}
func excelView(_ excelView: ExcelView, rowDataAt row: Int) -> [String] {
return dataSource[row]
}
func excelView(_ excelView: ExcelView, rowHeightAt row: Int) -> CGFloat {
return 40
}
func excelView(_ excelView: ExcelView, columnWidthAt column: Int) -> CGFloat {
return 120
}
func widthOfLeftHeader(in excelView: ExcelView) -> CGFloat {
return 50
}
func heightOfTopHeader(in excelView: ExcelView) -> CGFloat {
return 40
}
```
## implement `ExcelViewDelegate`
```Swift
func excelView(_ excelView: ExcelView, didTapGridWith content: String) {
print("didTapGridWith:\(content)")
}
func excelView(_ excelView: ExcelView, didTapColumnHeaderWith name: String) {
print("didTapColumnHeaderWith:\(name)")
}
```