// // 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() } } }