杨锴
2024-09-19 642175113bf6f2c90894e689dacda50278cad570
XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift
@@ -6,18 +6,51 @@
//
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()
        // Initialization code
                        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
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
            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
                                    }
                        }
            }
        // Configure the view for the selected state
    }
            @objc func tapAction(_ btn:UIButton){
                        let index = btn.tag - 1000
                        let vc = HomeItemDetailVC(id: items[index].id)
                        JQ_currentViewController().jq_push(vc: vc)
            }
}