MealHeadView.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // MealHeadView.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/10/26.
  6. //
  7. import UIKit
  8. class MealHeadView: UIView {
  9. @IBOutlet weak var foodImg: UIImageView!
  10. @IBOutlet weak var nameLab: UILabel!
  11. @IBOutlet weak var describLab: UILabel!
  12. @IBOutlet weak var sellDetailLab: UILabel!
  13. @IBOutlet weak var scoreLab: UILabel!
  14. var evaluateActionBlock : (()->Void)?
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. // topConstraint.constant = kStatuBarHeight + 25
  18. }
  19. func configModel(model : SetMealDetailModel){
  20. self.foodImg.sd_setImage(url: URL.init(string: model.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
  21. self.nameLab.text = "\(model.name ?? "")"
  22. self.describLab.text = "\(model.sellingPoints ?? "")"
  23. self.sellDetailLab.text = "\(model.specialty ?? "")"
  24. self.scoreLab.text = "\(model.score ?? "")"
  25. let labHeight : CGFloat = (self.describLab.frame.size.height)
  26. if self.describLab.text.isNotEmptyStr{
  27. self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 ))
  28. }else{
  29. self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 - 15 + labHeight ))
  30. }
  31. }
  32. @IBAction func evaluateAction(_ sender: UIButton) {
  33. if self.evaluateActionBlock != nil{
  34. self.evaluateActionBlock!()
  35. }
  36. }
  37. }