//
|
// CityChooseSubTypeView.swift
|
// WanPai
|
//
|
// Created by 杨锴 on 2023/6/13.
|
//
|
|
import UIKit
|
import JQTools
|
|
class CityChooseSubTypeView: UIView,JQNibView{
|
@IBOutlet weak var cons_viewHeight: NSLayoutConstraint!
|
private var closeClouse:(()->Void)?
|
private var clouse:((String)->Void)?
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
cons_viewHeight.constant = 100
|
alpha = 0
|
layoutIfNeeded()
|
}
|
|
|
static func show(inView:UIView,afterView:UIView,clouse:@escaping (String)->Void,closeClouse:@escaping ()->Void){
|
let subTypeView = CityChooseSubTypeView.jq_loadNibView()
|
subTypeView.closeClouse = closeClouse
|
subTypeView.clouse = clouse
|
inView.addSubview(subTypeView)
|
subTypeView.snp.makeConstraints { make in
|
make.top.equalTo(afterView.snp.bottom)
|
make.left.right.bottom.equalToSuperview()
|
}
|
|
UIView.animate(withDuration: 0.2) {
|
subTypeView.alpha = 1
|
} completion: { _ in
|
subTypeView.cons_viewHeight.constant = JQ_ScreenH - 175 - UIDevice.jq_safeEdges.top - JQ_NavBarHeight
|
UIView.animate(withDuration: 0.2) {
|
subTypeView.layoutIfNeeded()
|
}
|
}
|
}
|
|
|
@IBAction func closeAction(_ sender: UIButton) {
|
self.cons_viewHeight.constant = 100
|
UIView.animate(withDuration: 0.2) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
} completion: { _ in
|
self.removeFromSuperview()
|
self.closeClouse!()
|
}
|
}
|
}
|