62 lines
2.4 KiB
Swift
62 lines
2.4 KiB
Swift
//
|
||
// MPPositive_PlayerLyricView.swift
|
||
// MusicPlayer
|
||
//
|
||
// Created by Mr.Zhou on 2024/5/8.
|
||
//
|
||
|
||
import UIKit
|
||
//B面播放器歌词View(标题,副标题,歌词)
|
||
class MPPositive_PlayerLyricView: UIView {
|
||
///标题
|
||
lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 20*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.85), textAlignment: .left)
|
||
///副标题
|
||
lazy var subtitleLabel:UILabel = createLabel(font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#EEEEEE", alpha: 0.45), textAlignment: .left)
|
||
//展示ScrollView
|
||
lazy var scrollView:UIScrollView = {
|
||
let scrollView = UIScrollView()
|
||
scrollView.backgroundColor = .clear
|
||
scrollView.showsVerticalScrollIndicator = false
|
||
scrollView.showsHorizontalScrollIndicator = false
|
||
scrollView.addSubview(lyricsLabel)
|
||
scrollView.contentSize = .init(width: screen_Width, height: lyricsLabel.frame.origin.y + lyricsLabel.frame.height)
|
||
lyricsLabel.snp.makeConstraints { make in
|
||
make.width.equalToSuperview().multipliedBy(0.89)
|
||
make.centerX.equalToSuperview()
|
||
make.top.equalToSuperview().offset(15*width)
|
||
make.bottom.equalToSuperview().offset(-30*width)
|
||
}
|
||
return scrollView
|
||
}()
|
||
///歌词Label
|
||
lazy var lyricsLabel:UILabel = createLabel(font: .systemFont(ofSize: 16*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.85), textAlignment: .left, lines: 0)
|
||
override init(frame: CGRect) {
|
||
super.init(frame: frame)
|
||
backgroundColor = .clear
|
||
configure()
|
||
}
|
||
|
||
required init?(coder: NSCoder) {
|
||
super.init(coder: coder)
|
||
}
|
||
//配置
|
||
private func configure() {
|
||
addSubview(titleLabel)
|
||
titleLabel.snp.makeConstraints { make in
|
||
make.top.equalToSuperview().offset(33*width)
|
||
make.left.equalToSuperview().offset(18*width)
|
||
make.right.equalToSuperview().offset(-18*width)
|
||
}
|
||
addSubview(subtitleLabel)
|
||
subtitleLabel.snp.makeConstraints { make in
|
||
make.top.equalTo(titleLabel.snp.bottom).offset(10*width)
|
||
make.left.right.equalTo(titleLabel)
|
||
}
|
||
addSubview(scrollView)
|
||
scrollView.snp.makeConstraints { make in
|
||
make.top.equalTo(subtitleLabel.snp.bottom).offset(10*width)
|
||
make.left.right.bottom.equalToSuperview()
|
||
}
|
||
}
|
||
}
|