fix
杨锴
2024-08-23 adc2db9bb29e7f316c46b6de679db1522ffc9cc8
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
64
65
66
//
//  WatchHistoryDetailVC.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/8/22.
//
 
import UIKit
import JQTools
class WatchHistoryDetailVC: BaseVC {
 
                private var page:Int!
 
                private var collectionView:UICollectionView!
 
                init(page:Int) {
                                super.init(nibName: nil, bundle: nil)
                                self.page = page
                }
                
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
                
    override func viewDidLoad() {
        super.viewDidLoad()
 
                                let layout = UICollectionViewFlowLayout()
                                collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
                                collectionView.delegate = self
                                collectionView.dataSource = self
                                collectionView.showsVerticalScrollIndicator = false
                                collectionView.register(UINib(nibName: "HomeRelaxBannerCCell", bundle: nil), forCellWithReuseIdentifier: "_HomeRelaxBannerCCell")
                                collectionView.contentInset = UIEdgeInsets(top: 29, left: 29.5 , bottom: 0, right: 29.5)
 
                                view.addSubview(collectionView)
                                collectionView.snp.makeConstraints { make in
                                                make.edges.equalToSuperview()
                                }
    }
}
 
extension WatchHistoryDetailVC:UICollectionViewDelegate & UICollectionViewDataSource{
                func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
                                return 5
                }
 
                func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
                                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBannerCCell", for: indexPath) as! HomeRelaxBannerCCell
                                cell.contentView.backgroundColor = .jq_randomColor
                                return cell
                }
 
                func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
                                                let vc = HomeItemDetailVC()
                                                JQ_currentViewController().jq_push(vc: vc)
                }
}
 
extension WatchHistoryDetailVC:UICollectionViewDelegateFlowLayout{
                func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
 
                                let w = (JQ_ScreenW - (29.5 * 2) - 18.5) / 2
                                return CGSize(width: w, height: w * 1.3124)
                }
}