88 lines
2.7 KiB
Swift
88 lines
2.7 KiB
Swift
//
|
|
// HomeVoiceGuideView.swift
|
|
// yinmeng-ios
|
|
//
|
|
// Created by yinmeng on 2024/2/29.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class HomeVoiceGuideView: UIView {
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
setUILayout()
|
|
|
|
}
|
|
func setUILayout(){
|
|
backgroundColor = UIColor.init(white: 0, alpha: 0.5)
|
|
addSubview(imageView)
|
|
addSubview(arrowVeiw)
|
|
addSubview(bgTextVeiw)
|
|
bgTextVeiw.addSubview(textView)
|
|
addSubview(clickBtn)
|
|
imageView.snp.makeConstraints { make in
|
|
make.width.equalTo(124)
|
|
make.height.equalTo(106)
|
|
make.left.equalTo(64)
|
|
make.top.equalTo(480)
|
|
}
|
|
arrowVeiw.snp.makeConstraints { make in
|
|
make.width.equalTo(26)
|
|
make.height.equalTo(66)
|
|
make.left.equalTo(153)
|
|
make.top.equalTo(self.imageView.snp.bottom).offset(15)
|
|
|
|
}
|
|
bgTextVeiw.snp.makeConstraints { make in
|
|
make.centerY.equalTo(self.arrowVeiw)
|
|
make.left.equalTo(self.arrowVeiw.snp.right)
|
|
make.width.equalTo(148)
|
|
make.height.equalTo(66)
|
|
}
|
|
textView.snp.makeConstraints { make in
|
|
make.top.equalTo(2)
|
|
make.left.right.bottom.equalTo(self.bgTextVeiw)
|
|
}
|
|
clickBtn.snp.makeConstraints { make in
|
|
make.edges.equalTo(self)
|
|
}
|
|
}
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
@objc func clickBtnAction(){
|
|
self.removeFromSuperview()
|
|
}
|
|
var clickBtn:UIButton = {
|
|
let _clickBtn = UIButton()
|
|
_clickBtn.addTarget(self, action: #selector(clickBtnAction), for: .touchUpInside)
|
|
return _clickBtn
|
|
}()
|
|
var imageView:UIImageView = {
|
|
let _imageView = UIImageView()
|
|
_imageView.image = UIImage(named: "yin_home_voice_guide_icon")
|
|
return _imageView
|
|
}()
|
|
var arrowVeiw:UIImageView = {
|
|
let _arrowVeiw = UIImageView()
|
|
|
|
_arrowVeiw.image = UIImage(named: "yin_home_voice_guide_arrow")
|
|
return _arrowVeiw
|
|
}()
|
|
var bgTextVeiw:UIImageView = {
|
|
let _bgTextVeiw = UIImageView()
|
|
let image = UIImage.image(color: ThemeColor(hexStr: "#6A60FF"), size: CGSize(width: 148, height: 66), corners: [.topRight,.bottomRight], radius: 10)
|
|
_bgTextVeiw.image = image
|
|
return _bgTextVeiw
|
|
}()
|
|
var textView:UILabel = {
|
|
let _textView = UILabel()
|
|
_textView.numberOfLines = 2
|
|
_textView.textColor = .white
|
|
_textView.text = "选择感兴趣的声音\n拖动至唱片机播放"
|
|
_textView.font = UIFont.systemFont(ofSize: 14, weight: .medium)
|
|
return _textView
|
|
}()
|
|
}
|