// // CenterTableViewCell.swift // MusicPlayer // // Created by Mr.Zhou on 2024/4/2. // import UIKit class MPSideA_CenterTableViewCell: UITableViewCell { @IBOutlet weak var coverImageView: UIImageView! @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var durationLabel: UILabel! @IBOutlet weak var maskAnimationView: MP_WaveAnimationMaskView!{ didSet{ maskAnimationView.configure() } } var musicView:MPSideA_MusicViewModel!{ didSet{ coverImageView.image = musicView.cover titleLabel.text = musicView.title durationLabel.text = musicView.duration //判断当前音乐是否播放中,是不是这首音乐 guard MPSideA_MediaCenterManager.shared.getPlayerState() == .Playing, MPSideA_MediaCenterManager.shared.getMusic()?.identifier == musicView.music.identifier else { //展示未播放状态 titleLabel.textColor = .init(hex: "#FFFFFF") durationLabel.textColor = .init(hex: "#FFFFFF") maskAnimationView.isHidden = true maskAnimationView.stopAnimation() return } //展示播放状态 titleLabel.textColor = .init(hex: "#80F988") durationLabel.textColor = .init(hex: "#80F988") maskAnimationView.isHidden = false maskAnimationView.startAnimation() } } 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) } }