美文网首页
iOS封装:极简/轻量级 NNExcelView 封装, lik

iOS封装:极简/轻量级 NNExcelView 封装, lik

作者: SoaringHeart | 来源:发表于2020-05-24 13:30 被阅读0次

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

ezgif.com-video-to-gif (1).gif Simulator Screen Shot - iPhone 6s Plus - 2020-05-23 at 10.07.43.png Simulator Screen Shot - iPhone 6s Plus - 2020-05-23 at 10.07.47.png Simulator Screen Shot - iPhone 6s Plus - 2020-05-23 at 10.07.52.png
//
//  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)}")
    }
   
}

github

相关文章

网友评论

      本文标题:iOS封装:极简/轻量级 NNExcelView 封装, lik

      本文链接:https://www.haomeiwen.com/subject/cuadahtx.html