Music_Player3/relax.offline.mp3.music/MP/MPPositive/Views/Search/MPPositive_SearchGrideCollectionViewCell.swift
2024-07-12 19:33:23 +08:00

46 lines
1.4 KiB
Swift

//
// MPPositive_SearchGrideCollectionViewCell.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/7/12.
//
import UIKit
import MarqueeLabel
class MPPositive_SearchGrideCollectionViewCell: UICollectionViewCell {
//
private lazy var colorView:UIView = .init()
//Label
private lazy var titleLabel:UILabel = createMarQueeLabel("Loading", font: .systemFont(ofSize: 16, weight: .bold), textColor: .white)
var gride:MPPositive_GridViewModel!{
didSet{
colorView.backgroundColor = .randomColor
titleLabel.text = gride.title
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .init(hex: "#1F1F1F")
layer.masksToBounds = true
layer.cornerRadius = 10*width
confirgue()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
//
private func confirgue() {
addSubview(colorView)
colorView.snp.makeConstraints { make in
make.top.left.bottom.equalToSuperview()
make.width.equalToSuperview().multipliedBy(0.2)
}
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(colorView.snp.right).offset(12*width)
make.right.equalToSuperview().offset(-12*width)
}
}
}