杨锴
2024-08-14 909e20941e45f8712c012db602034b47da0bfdb0
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
//
//  BackgroundVoiceVC.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/8/14.
//
 
import UIKit
import QMUIKit
import JQTools
 
class BackgroundVoiceVC: BaseVC {
 
                @IBOutlet weak var slider_voice: UISlider!
                @IBOutlet weak var collectionView: UICollectionView!
                
                override func viewDidLoad() {
        super.viewDidLoad()
                                title = "心泉·疗愈"
                                
    }
 
                override func setUI() {
 
                                let v1 = UIView()
                                v1.backgroundColor = UIColor(hexStr: "#B6DC90")
                                v1.bounds = CGRect(x: 0, y: 0, width: 17, height: 17)
                                v1.jq_borderWidth = 2
                                v1.jq_borderColor = .white
                                v1.jq_cornerRadius = 8.5
 
                                slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .normal)
                                slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .highlighted)
 
                                collectionView.collectionViewLayout = TestLeftRightCollectionViewFlowLayout(width: JQ_ScreenW, height: 213.5)
                                collectionView.delegate = self
                                collectionView.dataSource = self
                                collectionView.isPagingEnabled = false
                                collectionView.bounces = false
                                collectionView.showsHorizontalScrollIndicator = false
                                collectionView.register(UINib(nibName: "HomeRelaxVoiceCCell", bundle: nil), forCellWithReuseIdentifier: "_HomeRelaxVoiceCCell")
                                collectionView.scrollToItem(at: IndexPath(row: 2, section: 0), at: .centeredHorizontally, animated: true)
                                collectionView.contentInset = UIEdgeInsets(top: 0, left: 100 , bottom: 0, right: 100)
                }
}
 
extension BackgroundVoiceVC: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: "_HomeRelaxVoiceCCell", for: indexPath) as! HomeRelaxVoiceCCell
                                cell.contentView.backgroundColor = .jq_randomColor
                                return cell
                }
}
 
extension BackgroundVoiceVC:UICollectionViewDelegateFlowLayout{
                func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
                                return CGSize(width: 148.25, height: 213.45)
                }
}