无故事王国
2023-06-28 a56ff03fc62bb894160f9b71fc54f66e77e48712
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
61
62
63
//
//  CourseInfoScheduleVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/25.
//
 
import UIKit
import JQTools
 
class CourseInfoScheduleVC: BaseVC {
 
    private var cellW:Double!
    private var cellH:Double!
 
    private let weeks = ["一","二","三","四","五","六","日"]
 
    @IBOutlet weak var weekCollectionView: UICollectionView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
 
    }
 
    override func setUI() {
        weekCollectionView.register(UINib(nibName: "CourseDatetimeCCell", bundle: nil), forCellWithReuseIdentifier: "_CourseDatetimeCCell")
        weekCollectionView.delegate = self
        weekCollectionView.dataSource = self
        weekCollectionView.isScrollEnabled = false
 
        cellW = (JQ_ScreenW - 22 - 114 - 60) / 7
        cellH = cellW * 1.785
    }
}
 
extension CourseInfoScheduleVC:UICollectionViewDelegate{
 
}
 
extension CourseInfoScheduleVC:UICollectionViewDataSource{
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return weeks.count
    }
 
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = weekCollectionView.dequeueReusableCell(withReuseIdentifier: "_CourseDatetimeCCell", for: indexPath) as! CourseDatetimeCCell
        cell.label_week.jq_cornerRadius = cellW / 2
        cell.label_week.jq_masksToBounds = true
        cell.label_week.text = weeks[indexPath.row]
        cell.jq_masksToBounds = false
        return cell
    }
}
 
extension CourseInfoScheduleVC:UICollectionViewDelegateFlowLayout{
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
        return 19
    }
 
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: cellW, height: cellH)
    }
}