Visual_Novel_iOS/crush/Crush/Src/Components/UI/BaseView/VoiceSelectView.swift

72 lines
1.9 KiB
Swift
Raw Normal View History

2025-10-09 10:29:35 +00:00
//
// VoiceSelectView.swift
// Crush
//
// Created by Leon on 2025/7/20.
//
/// block +
class VoiceSelectView:UIView{
var iv: CLImageView!
var titleLabel: UILabel!
var topButton: UIButton!
var topTapBlock: (() -> Void)?
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupViews(){
backgroundColor = .c.csen
layer.cornerRadius = 16
clipsToBounds = true
iv = {
let v = CLImageView(frame: .zero)
v.image = MWIconFont.image(fromIcon: .voice, size: CGSize(width: 24, height: 24), color: .c.ctsn)
addSubview(v)
v.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(24)
make.size.equalTo(CGSize(width: 24, height: 24))
}
return v
}()
titleLabel = {
let v = UILabel()
v.font = .t.tbm
v.textColor = .c.ctsn
addSubview(v)
v.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(iv.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-24)
}
return v
}()
titleLabel.text = "Select 1 voice from below"
topButton = {
let v = UIButton()
addSubview(v)
v.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
v.addTarget(self, action: #selector(topButtonTap), for: .touchUpInside)
return v
}()
}
@objc private func topButtonTap(){
topTapBlock?()
}
}