12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // MenuHeadView.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/4.
- //
- import UIKit
- class MenuHeadView: UIView {
- @IBOutlet weak var backImageView: UIImageView!
-
- @IBOutlet weak var topHeight: NSLayoutConstraint!
- var HeadTimeRangeAction : (()->Void)?
- var backBlock : (()->Void)?
- var deletActionBlock : (()->Void)?
- var selectBlock : ((_ model : HomeTimeItem)->Void)?
-
- let dateView = Bundle.main.loadNibNamed("HomeDateView", owner: nil, options: nil)?.last as? HomeDateView
-
- override func awakeFromNib() {
- super.awakeFromNib()
- self.addSubview(dateView!)
- topHeight.constant = kStatuBarHeight + 25
- self.dateView!.mas_remakeConstraints { make in
- make?.left.right().bottom().mas_equalTo()(self)
- make?.height.offset()(160)
- }
- self.dateView?.timeRangeAction = {[weak self] in
-
- if (self?.HeadTimeRangeAction != nil)
- {
- self?.HeadTimeRangeAction!()
- }
- }
-
-
- self.dateView?.selectBlock = {[weak self] model in
- if (self?.selectBlock != nil){
- self?.selectBlock!(model)
- }
- }
-
- self.dateView?.deletActionBlock = {[weak self] in
- if (self?.deletActionBlock != nil){
- self?.deletActionBlock!()
- }
- }
- }
-
- @IBAction func backAction(_ sender: UIButton) {
- if (self.backBlock != nil){
- self.backBlock!()
- }
- }
-
- func configModel(dateModel : HomeTimeRangModel ){
- self.dateView?.configModel(dateModel: dateModel)
- self.dateView?.timeBtn.isHidden = true
- self.dateView?.deletBtn.isHidden = false
- self.dateView?.titleLab.text = LanguagesUtil.createTextBy(Ctext: "已选菜品", Etext: "selected foods")
- }
-
- }
|