杨锴
2024-10-08 c6ba9750e8305dd777fffbd87d4052cfe6a23a5b
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
//
//  Home_Style_5_TCell.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/9/9.
//
 
import UIKit
import JQTools
 
class Home_Style_5_TCell: UITableViewCell {
 
                private var items = [HomeTopMenuItem]()
                @IBOutlet weak var btn_1: UIButton!
                @IBOutlet weak var btn_2: UIButton!
                @IBOutlet weak var btn_3: UIButton!
                
    override func awakeFromNib() {
        super.awakeFromNib()
                                btn_1.isHidden = true
                                btn_2.isHidden = true
                                btn_3.isHidden = true
 
                                btn_1.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
                                btn_2.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
                                btn_3.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
 
                                btn_1.tag = 1000
                                btn_2.tag = 1001
                                btn_3.tag = 1002
    }
 
                func setHomeTopMenuItem(_ items:[HomeTopMenuItem]){
                                self.items = items
                                for (index,v) in items.enumerated(){
                                                switch index {
                                                                case 0:
                                                                                btn_1.sd_setImage(with: URL(string: v.image), for: .normal)
                                                                                btn_1.isHidden = false
                                                                case 1:
                                                                                btn_2.sd_setImage(with: URL(string: v.image), for: .normal)
                                                                                btn_2.isHidden = false
                                                                case 2:
                                                                                btn_3.sd_setImage(with: URL(string: v.image), for: .normal)
                                                                                btn_3.isHidden = false
                                                                default:break
                                                }
                                }
                }
 
                @objc func tapAction(_ btn:UIButton){
                                let index = btn.tag - 1000
                                let vc = HomeItemDetailVC(id: items[index].id)
                                JQ_currentViewController().jq_push(vc: vc)
                }
}