70 lines
2.3 KiB
Swift
70 lines
2.3 KiB
Swift
//
|
||
// MPPositive_MoreOperationTableViewCell.swift
|
||
// MusicPlayer
|
||
//
|
||
// Created by Mr.Zhou on 2024/5/29.
|
||
//
|
||
|
||
import UIKit
|
||
import DownloadButton
|
||
class MPPositive_MoreOperationDownLoadTableViewCell: UITableViewCell {
|
||
//特殊图片(展示预览图片)
|
||
private lazy var iconImageView:UIImageView = {
|
||
let imageView:UIImageView = .init()
|
||
imageView.contentMode = .scaleAspectFill
|
||
imageView.layer.masksToBounds = true
|
||
return imageView
|
||
}()
|
||
//设置下载按钮
|
||
private lazy var LoadBtn:PKDownloadButton = {
|
||
let btn:PKDownloadButton = .init()
|
||
//禁止交互
|
||
btn.isUserInteractionEnabled = false
|
||
btn.downloadedButton.cleanDefaultAppearance()
|
||
// btn.downloadedButton.setBackgroundImage(UIImage(named: ""), for: <#T##UIControl.State#>)
|
||
return btn
|
||
}()
|
||
|
||
private lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 14*width, weight: .regular), textColor: .white, textAlignment: .left)
|
||
var title:String!{
|
||
didSet{
|
||
iconImageView.image = UIImage(named: title)
|
||
titleLabel.text = title
|
||
}
|
||
}
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||
selectionStyle = .none
|
||
backgroundColor = .clear
|
||
configure()
|
||
}
|
||
|
||
required init?(coder: NSCoder) {
|
||
super.init(coder: coder)
|
||
}
|
||
override func awakeFromNib() {
|
||
super.awakeFromNib()
|
||
// Initialization code
|
||
}
|
||
|
||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||
super.setSelected(selected, animated: animated)
|
||
|
||
// Configure the view for the selected state
|
||
}
|
||
private func configure() {
|
||
contentView.addSubview(iconImageView)
|
||
iconImageView.snp.makeConstraints { make in
|
||
make.width.height.equalTo(24*width)
|
||
make.top.equalToSuperview().offset(12*width).priority(999)
|
||
make.bottom.equalToSuperview().offset(-12*width)
|
||
make.left.equalToSuperview().offset(18*width)
|
||
}
|
||
contentView.addSubview(titleLabel)
|
||
titleLabel.snp.makeConstraints { make in
|
||
make.centerY.equalToSuperview()
|
||
make.left.equalTo(iconImageView.snp.right).offset(12*width)
|
||
}
|
||
}
|
||
}
|