//
|
// ChooseStoreView.swift
|
// WanPai
|
//
|
// Created by 无故事王国 on 2023/6/29.
|
//
|
|
import UIKit
|
import JQTools
|
|
class ChooseStoreView: UIView,JQNibView{
|
|
@IBOutlet weak var view_container: UIView!
|
@IBOutlet weak var view_bottomContainer: NSLayoutConstraint!
|
@IBOutlet weak var tableView: UITableView!
|
private var clouse:(()->Void)!
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.separatorStyle = .none
|
tableView.register(UINib(nibName: "CommonSingleTCell", bundle: nil), forCellReuseIdentifier: "_CommonSingleTCell")
|
view_bottomContainer.constant = -(JQ_ScreenW * 0.8153)
|
alpha = 0
|
layoutIfNeeded()
|
}
|
|
static func show(_ clouse:@escaping ()->Void){
|
let chooseStoreView = ChooseStoreView.jq_loadNibView()
|
chooseStoreView.frame = screnDelegate?.window?.frame ?? .zero
|
screnDelegate?.window?.addSubview(chooseStoreView)
|
chooseStoreView.view_bottomContainer.constant = 0
|
chooseStoreView.clouse = clouse
|
UIView.animate(withDuration: 0.4) {
|
chooseStoreView.alpha = 1
|
chooseStoreView.layoutIfNeeded()
|
}
|
}
|
|
@IBAction func closeAction(_ sender: Any) {
|
view_bottomContainer.constant = -(JQ_ScreenW * 0.8153)
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
} completion: { _ in
|
self.removeFromSuperview()
|
}
|
}
|
|
@IBAction func completeAction(_ sender: UIButton) {
|
view_bottomContainer.constant = -(JQ_ScreenW * 0.8153)
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
} completion: { _ in
|
self.removeFromSuperview()
|
self.clouse!()
|
}
|
}
|
|
override func layoutSubviews() {
|
super.layoutSubviews()
|
view_container.jq_addCorners(corner: [.topLeft,.topRight], radius: 20)
|
}
|
}
|
|
extension ChooseStoreView:UITableViewDelegate{
|
|
}
|
|
extension ChooseStoreView:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_CommonSingleTCell") as! CommonSingleTCell
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 68
|
}
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return 5
|
}
|
}
|