Visual_Novel_iOS/crush/Crush/Src/Components/UI/Sheet/GiftAIRoleSheet.swift

94 lines
2.9 KiB
Swift

//
// GiftAIRoleSheet.swift
// Crush
//
// Created by Leon on 2025/9/13.
//
class GiftAIRoleSheet: EGPopBaseView{
var titleLabel:UILabel!
var descLabel : CLLabel!
var closeButton: EPIconTertiaryButton!
var giftView : GiftGridSendView!
init(){
super.init(direction: .bottom)
contentView.backgroundColor = .c.csbn
contentLength = 80 + 32 + 280 + UIWindow.safeAreaBottom
setupViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupViews() {
closeButton = {
let v = EPIconTertiaryButton(radius: .round, iconSize: .small, iconCode: .delete)
v.addTarget(self, action: #selector(bgButtonPressed), for: .touchUpInside)
contentView.addSubview(v)
v.snp.makeConstraints { make in
make.top.equalToSuperview().offset(20)
make.size.equalTo(v.bgImageSize())
make.trailing.equalToSuperview().offset(-16)
}
return v
}()
titleLabel = {
let v = UILabel()
v.font = .t.ttm
v.textColor = .text
v.textAlignment = .center
contentView.addSubview(v)
v.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(24)
make.trailing.equalToSuperview().offset(-24)
make.top.equalToSuperview().offset(32)
}
return v
}()
descLabel = {
let v = CLLabel()
v.font = .t.tbs
contentView.addSubview(v)
v.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(CGFloat.lrs)
make.trailing.equalToSuperview().offset(-CGFloat.lrs)
//make.top.equalTo(titleLabel.snp.bottom).offset(24)
//make.top.equalToSuperview().offset(80)
make.centerY.equalTo(contentView.snp.top).offset(80+10)
}
return v
}()
giftView = {
let v = GiftGridSendView()
contentView.addSubview(v)
v.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview()
//make.top.equalTo(descLabel.snp.bottom).offset(12)
make.bottom.equalToSuperview().offset(-UIWindow.safeAreaBottom)
}
return v
}()
titleLabel.text = "Gift"
descLabel.text = "Giving gifts greatly increases the probability of matching"
}
// override func layoutSubviews() {
// super.layoutSubviews()
//
// dlog("testtttt \(self) giftView:\(String(describing: giftView))")
// if giftView.bounds.size.height > 0{
// contentLength = giftView.frame.maxY
// }
// }
}