Music_Player3/MusicPlayer/MP/MPPositive/Views/Home/MPPositive_ArtistShowCollectionViewCell.swift
2024-05-20 13:44:14 +08:00

57 lines
1.9 KiB
Swift

//
// MPPositive_ArtistShowCollectionViewCell.swift
// MusicPlayer
//
// Created by Mr.Zhou on 2024/5/16.
//
import UIKit
///cell
class MPPositive_ArtistShowCollectionViewCell: UICollectionViewCell {
///
private lazy var avatarImageView:UIImageView = {
let imageView:UIImageView = .init()
imageView.contentMode = .scaleAspectFill
imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = 82*width
return imageView
}()
///
private lazy var titleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 14*width, weight: .regular), textColor: .white, textAlignment: .center)
///
private lazy var subtitleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.6), textAlignment: .center)
var itemView:MPPositive_BrowseItemViewModel!{
didSet{
itemView.setUrltoImage(avatarImageView)
titleLabel.text = itemView.title
subtitleLabel.text = itemView.subtitle
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .clear
configure()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
private func configure() {
addSubview(avatarImageView)
avatarImageView.snp.makeConstraints { make in
make.left.top.right.equalToSuperview()
make.height.equalTo(164*width)
}
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(avatarImageView.snp.bottom).offset(16*width)
}
addSubview(subtitleLabel)
subtitleLabel.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
}
}
}