公司有个需求上方展示图表 echart / AAInfographics,下放展示图标对应的数据,需要可以左右滑动,每一行对应一天所有的数据种类,左右滑动时第一列锁定,上下滑动时第一行锁定,随封装一个高仿 Microsoft Excel 的视图,轻量级




//
// UICollectionExcelController.swift
// SwiftTemplet
//
// Created by Bin Shang on 2020/5/22.
// Copyright © 2020 BN. All rights reserved.
//
import UIKit
import NNExcelView
class UICollectionExcelController: UIViewController{
lazy var excelView: NNExcelView = {
let excelView = NNExcelView(frame: self.view.bounds)
// excelView.lockColumn = 2
excelView.delegate = self
return excelView
}()
// MARK: -lifecycle
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "NNExcelView"
view.backgroundColor = .white
view.addSubview(excelView)
excelView.frame = CGRect(x: 0, y: 70, width: self.view.bounds.width, height: 300)
excelView.reloadData()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
extension UICollectionExcelController: NNExcelViewDelegate {
func excelView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("\(#function)_{\(indexPath.section),\(indexPath.row)}")
}
}
网友评论