67 lines
1.6 KiB
Swift
67 lines
1.6 KiB
Swift
//
|
|
// SPCollectListCell.swift
|
|
// ShortPlay
|
|
//
|
|
// Created by 曾觉新 on 2025/4/18.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SPCollectListCell: SPCollectionViewCell {
|
|
|
|
var model: SPShortModel? {
|
|
didSet {
|
|
coverImageView.sp_setImage(url: model?.image_url)
|
|
titleLabel.text = model?.name
|
|
}
|
|
}
|
|
|
|
private lazy var coverImageView: SPImageView = {
|
|
let imageView = SPImageView()
|
|
imageView.layer.cornerRadius = 7
|
|
imageView.layer.masksToBounds = true
|
|
return imageView
|
|
}()
|
|
|
|
private lazy var titleLabel: UILabel = {
|
|
let label = UILabel()
|
|
label.font = .fontRegular(ofSize: 13)
|
|
label.textColor = .colorFFFFFF(alpha: 0.9)
|
|
label.numberOfLines = 2
|
|
return label
|
|
}()
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
|
|
|
|
_setupUI()
|
|
}
|
|
|
|
@MainActor required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
}
|
|
|
|
extension SPCollectListCell {
|
|
|
|
private func _setupUI() {
|
|
contentView.addSubview(coverImageView)
|
|
contentView.addSubview(titleLabel)
|
|
|
|
coverImageView.snp.makeConstraints { make in
|
|
make.left.right.top.equalToSuperview()
|
|
make.bottom.equalToSuperview().offset(-36)
|
|
}
|
|
|
|
titleLabel.snp.makeConstraints { make in
|
|
make.left.equalToSuperview()
|
|
make.top.equalTo(coverImageView.snp.bottom).offset(5)
|
|
make.right.lessThanOrEqualToSuperview()
|
|
}
|
|
|
|
}
|
|
|
|
}
|