| | |
| | | // |
| | | |
| | | import UIKit |
| | | import JQTools |
| | | |
| | | class CourseDetail_2_TCell: UITableViewCell { |
| | | |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var cons_tableHei: NSLayoutConstraint! |
| | | |
| | | // private(set) var clouse:((IndexPath)->Void)? |
| | | private var items = [CourseItemModel]() |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | |
| | | tableView.backgroundColor = UIColor(hexString: "f6f6f6") |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "CourseDetail_2_Inner_TCell", bundle: nil), forCellReuseIdentifier: "_CourseDetail_2_Inner_TCell") |
| | | cons_tableHei.constant = 70.5 * 5 |
| | | cons_tableHei.constant = 0 |
| | | } |
| | | |
| | | // func selectAt(_ clouse:@escaping (IndexPath)->Void){ |
| | | // if self.clouse == nil{ |
| | | // self.clouse = clouse |
| | | // } |
| | | // } |
| | | func setItems(_ items:[CourseItemModel]){ |
| | | self.items = items |
| | | cons_tableHei.constant = 70.5 * Double(items.count) |
| | | self.tableView.reloadData() |
| | | } |
| | | } |
| | | |
| | | extension CourseDetail_2_TCell:UITableViewDelegate & UITableViewDataSource{ |
| | | |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | // clouse?(indexPath) |
| | | let vc = CourseDetialVideoVC(items: items, selectIndex: indexPath) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | return 5 |
| | | return items.count |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | let model = items[indexPath.row] |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseDetail_2_Inner_TCell", for: indexPath) as! CourseDetail_2_Inner_TCell |
| | | cell.setModel(model, index: indexPath) |
| | | cell.backgroundColor = .clear |
| | | return cell |
| | | } |