// // MealHeadView.swift // ADHTuanCan // // Created by 敖德亨 on 2023/10/26. // import UIKit class MealHeadView: UIView { @IBOutlet weak var foodImg: UIImageView! @IBOutlet weak var nameLab: UILabel! @IBOutlet weak var describLab: UILabel! @IBOutlet weak var sellDetailLab: UILabel! @IBOutlet weak var scoreLab: UILabel! var evaluateActionBlock : (()->Void)? override func awakeFromNib() { super.awakeFromNib() // topConstraint.constant = kStatuBarHeight + 25 } func configModel(model : SetMealDetailModel){ self.foodImg.sd_setImage(url: URL.init(string: model.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage")) self.nameLab.text = "\(model.name ?? "")" self.describLab.text = "\(model.sellingPoints ?? "")" self.sellDetailLab.text = "\(model.specialty ?? "")" self.scoreLab.text = "\(model.score ?? "")" let labHeight : CGFloat = (self.describLab.frame.size.height) if self.describLab.text.isNotEmptyStr{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 )) }else{ self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 - 15 + labHeight )) } } @IBAction func evaluateAction(_ sender: UIButton) { if self.evaluateActionBlock != nil{ self.evaluateActionBlock!() } } }