// // MyClassViewController.swift // xingchuangke // // Created by Virgil on 2019/5/13. // Copyright © 2019 Virgil. All rights reserved. // import UIKit class MyClassViewController: BaseViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var tableView: UITableView! let arrTitle = ["最近学习", "我的培训"] //,"下载管理" let arrImage = ["ion_study_08", "ion_study_09"] //,"ion_study_10" override func viewDidLoad() { super.viewDidLoad() self.title = "我的课程" initNavLeftBackButton() tableView.register(UINib(nibName: "CommonMyMenuTableViewCell", bundle: nil), forCellReuseIdentifier: "CommonMyMenuTableViewCell") tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none tableView.showsVerticalScrollIndicator = false tableView.estimatedRowHeight = 100 } // MARK: TABLEVLEW 实现 func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return arrTitle.count } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 15 } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 58 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CommonMyMenuTableViewCell", for: indexPath as IndexPath) as! CommonMyMenuTableViewCell cell.lblTitle.text = arrTitle[indexPath.row] cell.btnLeftImage.setImage(UIImage(named: arrImage[indexPath.row]), for: .normal) cell.lblRight.isHidden = true cell.imgRightContent.isHidden = true return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if arrTitle[indexPath.row] == "最近学习" { toViewController(viewController: StudyRecordViewController()) } else if arrTitle[indexPath.row] == "我的培训" { toViewController(viewController: UnderLineTrainRecordViewController()) } else if arrTitle[indexPath.row] == "下载管理" { } } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: "MyClassViewController", bundle: nil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }