90 lines
3.4 KiB
Swift
90 lines
3.4 KiB
Swift
//
|
||
// MPPositive_BottomShowView.swift
|
||
// MusicPlayer
|
||
//
|
||
// Created by Mr.Zhou on 2024/4/19.
|
||
//
|
||
|
||
import UIKit
|
||
///b面底部播放音乐展示View
|
||
class MPPositive_BottomShowView: UIView {
|
||
//绿色背景图片
|
||
private lazy var bgGreenImageView:UIImageView = UIImageView(image: .init(named: "BottomShow'bg"))
|
||
//音乐封面展示圆框
|
||
private lazy var coverImageView:UIImageView = {
|
||
let imageView:UIImageView = .init(frame: .init(x: 26*width, y: 13*width, width: 48*width, height: 48*width))
|
||
imageView.contentMode = .scaleAspectFill
|
||
imageView.layer.cornerRadius = 24*width
|
||
imageView.layer.masksToBounds = true
|
||
return imageView
|
||
}()
|
||
//标题Label
|
||
private lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 16*width, weight: .semibold), textColor: .init(hex: "#000000"), textAlignment: .left)
|
||
//副标题(歌手/专辑/乐队)
|
||
private lazy var subtitleLabel:UILabel = createLabel(font: .systemFont(ofSize: 12*width, weight: .light), textColor: .init(hex: "#000000"), textAlignment: .left)
|
||
//音乐列表按钮
|
||
private lazy var listsBtn:UIButton = {
|
||
let btn = UIButton()
|
||
btn.setBackgroundImage(UIImage(named: "Bottom Lists'logo"), for: .normal)
|
||
btn.addTarget(self, action: #selector(expandListsClick(_ :)), for: .touchUpInside)
|
||
return btn
|
||
}()
|
||
//音乐播放器状态按钮
|
||
private lazy var playStatuBtn:UIButton = {
|
||
let btn = UIButton()
|
||
btn.setBackgroundImage(UIImage(named: "Bottom Pause'logo"), for: .normal)
|
||
btn.setBackgroundImage(UIImage(named: "Bottom Play'logo"), for: .selected)
|
||
btn.addTarget(self, action: #selector(switchStatuClick(_ :)), for: .touchUpInside)
|
||
return btn
|
||
}()
|
||
override init(frame: CGRect) {
|
||
super.init(frame: frame)
|
||
confirgue()
|
||
}
|
||
|
||
required init?(coder: NSCoder) {
|
||
super.init(coder: coder)
|
||
}
|
||
//配置
|
||
private func confirgue() {
|
||
addSubview(bgGreenImageView)
|
||
bgGreenImageView.snp.makeConstraints { make in
|
||
make.left.right.top.bottom.equalToSuperview()
|
||
}
|
||
addSubview(coverImageView)
|
||
addSubview(listsBtn)
|
||
listsBtn.snp.makeConstraints { make in
|
||
make.right.equalToSuperview().offset(-24*width)
|
||
make.top.equalToSuperview().offset(21*width)
|
||
make.height.width.equalTo(32*width)
|
||
}
|
||
addSubview(playStatuBtn)
|
||
playStatuBtn.snp.makeConstraints { make in
|
||
make.width.height.equalTo(24*width)
|
||
make.centerY.equalTo(listsBtn)
|
||
make.right.equalTo(listsBtn.snp.left).offset(-20*width)
|
||
}
|
||
addSubview(titleLabel)
|
||
titleLabel.snp.makeConstraints { make in
|
||
make.top.equalTo(coverImageView).offset(5*width)
|
||
make.left.equalTo(coverImageView.snp.right).offset(12*width)
|
||
make.right.equalTo(playStatuBtn.snp.left).offset(-10*width)
|
||
}
|
||
addSubview(subtitleLabel)
|
||
subtitleLabel.snp.makeConstraints { make in
|
||
make.left.equalTo(titleLabel)
|
||
make.top.equalTo(titleLabel.snp.bottom).offset(4*width)
|
||
make.right.equalTo(titleLabel)
|
||
}
|
||
}
|
||
|
||
//展开当前音乐列表
|
||
@objc private func expandListsClick(_ sender:UIButton) {
|
||
|
||
}
|
||
//切换播放音乐状态
|
||
@objc private func switchStatuClick(_ sender:UIButton) {
|
||
|
||
}
|
||
}
|