Music_Player3/MusicPlayer/MP/Views/Center(个人资源)/CenterTableViewCell.swift
Mr.zhou 96147c5e37 项目:Musicoo
版本:A面 1.0
构建:1.1
更新内容:对项目A面功能的实现,经测试确定各项功能无问题。
更新时间:2024年4月12日 11:20
上传状态:已上传App Connect
2024-04-12 11:19:58 +08:00

51 lines
1.6 KiB
Swift

//
// CenterTableViewCell.swift
// MusicPlayer
//
// Created by Mr.Zhou on 2024/4/2.
//
import UIKit
class CenterTableViewCell: UITableViewCell {
@IBOutlet weak var coverImageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var durationLabel: UILabel!
var musicView:MusicViewModel!{
didSet{
coverImageView.image = musicView.cover
titleLabel.text = musicView.title
durationLabel.text = musicView.duration
//,
guard MPMediaCenterManager.shared.getPlayerState() == .Playing, MPMediaCenterManager.shared.getMusic()?.identifier == musicView.music.identifier else {
//
titleLabel.textColor = .init(hex: "#FFFFFF")
durationLabel.textColor = .init(hex: "#FFFFFF")
return
}
//
titleLabel.textColor = .init(hex: "#80F988")
durationLabel.textColor = .init(hex: "#80F988")
}
}
var moreBlock:((UIButton) -> Void)?
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
//
@IBAction func moreClick(_ sender: UIButton) {
guard moreBlock != nil else {
return
}
moreBlock!(sender)
}
}