杨锴
2024-09-12 e15c976316feef72ff9bcabce38e0a078f9505db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
//  CourseDetail_2_TCell.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/8/16.
//
 
import UIKit
import JQTools
 
class CourseDetail_2_TCell: UITableViewCell {
 
                @IBOutlet weak var tableView: UITableView!
                @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
 
                private var items = [CourseItemModel]()
 
                override func awakeFromNib() {
        super.awakeFromNib()
                                backgroundColor = .clear
                                selectionStyle = .none
                                tableView.delegate = self
                                tableView.dataSource = self
                                tableView.isScrollEnabled = false
                                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 = 0
    }
 
                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) {
                                let vc = CourseDetialVideoVC(items: items, selectIndex: indexPath)
                                JQ_currentViewController().jq_push(vc: vc)
                }
 
                func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                                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
                }
 
                func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
                                return 70.5
                }
}