EverybodyLoveItem.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // EverybodyLoveItem.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/9/30.
  6. //
  7. import UIKit
  8. class EverybodyLoveItem: UIView {
  9. @IBOutlet weak var priceLab: UILabel!
  10. @IBOutlet weak var foodImg: UIImageView!
  11. @IBOutlet weak var nameLab: UILabel!
  12. @IBOutlet weak var scoreLab: UILabel!
  13. @IBOutlet weak var rightBtn: UIButton!
  14. var touchUpActionBlock : (()->Void)?
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. // self.priceLab.addCorner(YDRectCorner(topLeft: 0, topRight: 15, bottomRight: 15))
  18. self.rightBtn.addCorner(YDRectCorner(topLeft: 15, topRight: 0, bottomLeft: 0,bottomRight: 0))
  19. }
  20. func configModel(model : HomeFoodDetailModel){
  21. self.priceLab.text = "s$\(model.price ?? "")"
  22. self.nameLab.text = "\(model.name ?? "")"
  23. self.scoreLab.text = "\(model.score ?? "0")"
  24. self.foodImg.sd_setImage(url: URL.init(string: model.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
  25. self.priceLab.addCorner(YDRectCorner(topLeft: 0, topRight: 15, bottomRight: 15))
  26. }
  27. @IBAction func touchUpAction(_ sender: UIButton) {
  28. if self.touchUpActionBlock != nil{
  29. self.touchUpActionBlock!()
  30. }
  31. }
  32. }