| | |
| | | class YardBookingTimeView: UIView,JQNibView{ |
| | | |
| | | @IBOutlet weak var cons_viewTop: NSLayoutConstraint! |
| | | @IBOutlet weak var tf_startTime: UITextField! |
| | | @IBOutlet weak var tf_endTime: UITextField! |
| | | |
| | | private var closeClouse:(()->Void)? |
| | | private var clouse:(()->Void)? |
| | | private var closeClouse:((String,String)->Void)? |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | |
| | | layoutIfNeeded() |
| | | } |
| | | |
| | | static func show(inView:UIView,afterView:UIView,clouse:@escaping ()->Void,closeClouse:@escaping ()->Void){ |
| | | @discardableResult |
| | | static func show(inView:UIView,afterView:UIView,closeClouse:@escaping (String,String)->Void)->YardBookingTimeView{ |
| | | let yardBookingTimeView = YardBookingTimeView.jq_loadNibView() |
| | | inView.addSubview(yardBookingTimeView) |
| | | yardBookingTimeView.closeClouse = closeClouse |
| | | yardBookingTimeView.clouse = clouse |
| | | yardBookingTimeView.snp.makeConstraints { make in |
| | | make.top.equalTo(afterView.snp.bottom) |
| | | make.left.right.bottom.equalTo(inView) |
| | |
| | | yardBookingTimeView.alpha = 1 |
| | | yardBookingTimeView.layoutIfNeeded() |
| | | } |
| | | return yardBookingTimeView |
| | | } |
| | | |
| | | |
| | | @IBAction func startTimeAction(_ sender: Any) { |
| | | CommonDatePickerView.show(before: 10, after: 0, type: .YM) {[weak self] year, month, _ in |
| | | self?.tf_startTime.text = String(format: "%ld-%02ld", year,month) |
| | | } |
| | | } |
| | | |
| | | @IBAction func endTimeAction(_ sender: Any) { |
| | | CommonDatePickerView.show(before: 0, after: 2, type: .YM) { [weak self] year, month, _ in |
| | | self?.tf_endTime.text = String(format: "%ld-%02ld", year,month) |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func closeAction(_ sender: Any) { |
| | | cons_viewTop.constant = -133 |
| | |
| | | self.alpha = 0 |
| | | self.layoutIfNeeded() |
| | | } completion: { _ in |
| | | self.closeClouse?() |
| | | let startDate = self.tf_startTime.text! |
| | | let endDate = self.tf_endTime.text! |
| | | self.closeClouse?(startDate,endDate) |
| | | self.removeFromSuperview() |
| | | } |
| | | } |