//
|
// 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 cons_btn_1_w: NSLayoutConstraint!
|
@IBOutlet weak var btn_2: UIButton!
|
@IBOutlet weak var cons_btn_2_w: NSLayoutConstraint!
|
@IBOutlet weak var btn_3: UIButton!
|
@IBOutlet weak var cons_btn_3_w: NSLayoutConstraint!
|
|
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
|
|
btn_1.jq_cornerRadius = 10
|
btn_2.jq_cornerRadius = 10
|
btn_3.jq_cornerRadius = 10
|
|
let w = (JQ_ScreenW - 19 * 2 - 9.5 * 2) / 3.0
|
cons_btn_1_w.constant = w
|
cons_btn_2_w.constant = w
|
cons_btn_3_w.constant = w
|
}
|
|
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 = HomeItemListVC(topTitle: items[index].title, id: items[index].id,showType: .vertical)
|
JQ_currentViewController().jq_push(vc: vc)
|
}
|
}
|