//
|
// CourseSendGiftView.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/19.
|
//
|
|
import UIKit
|
import JQTools
|
|
class CourseSendGiftView: UIView,JQNibView{
|
|
@IBOutlet weak var btn_complete: UIButton!
|
@IBOutlet weak var view_container: UIView!
|
@IBOutlet weak var label_price: UILabel!
|
@IBOutlet weak var cons_bottom: NSLayoutConstraint!
|
|
private var price:Double = 0
|
|
private var clouse:(()->Void)?
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
cons_bottom.constant = -JQ_ScreenW
|
alpha = 0
|
layoutIfNeeded()
|
}
|
|
static func show(price:Double,clouse:@escaping()->Void){
|
let view = CourseSendGiftView.jq_loadNibView()
|
view.frame = sceneDelegate?.window?.frame ?? .zero
|
view.label_price.text = "¥\(price.jq_formatFloat)"
|
sceneDelegate?.window?.addSubview(view)
|
view.clouse = clouse
|
view.cons_bottom.constant = 0
|
UIView.animate(withDuration: 0.4) {
|
view.alpha = 1
|
view.layoutIfNeeded()
|
}
|
}
|
|
override func layoutSubviews() {
|
super.layoutSubviews()
|
btn_complete.localGradientColor(cornerRadius: 18.5,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW - 46 * 2, height: 40))
|
}
|
|
@IBAction func completeAction(_ sender: UIButton) {
|
cons_bottom.constant = -JQ_ScreenW
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
}completion: { _ in
|
self.removeFromSuperview()
|
self.clouse?()
|
}
|
}
|
|
@IBAction func cancelAction(_ sender: UIButton) {
|
cons_bottom.constant = -JQ_ScreenW
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
}completion: { _ in
|
self.removeFromSuperview()
|
}
|
}
|
}
|