MealEcaluateCell.swift 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // MealEcaluateCell.swift
  3. // ADHTuanCan
  4. //
  5. // Created by 敖德亨 on 2023/11/11.
  6. //
  7. import UIKit
  8. class MealEcaluateCell: UITableViewCell {
  9. @IBOutlet weak var headImg: UIImageView!
  10. @IBOutlet weak var nameLab: UILabel!
  11. @IBOutlet weak var timeLab: UILabel!
  12. @IBOutlet weak var contentLab: UILabel!
  13. @IBOutlet var imgBackViewList: [UIView]!
  14. @IBOutlet var foodImgList: [UIImageView]!
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. // Initialization code
  18. }
  19. func configModel(model : NeedEvaluateListModel){
  20. for item in imgBackViewList {
  21. let vview : UIView = item
  22. vview.isHidden = true
  23. }
  24. var linksNum = model.links?.count ?? 0
  25. if linksNum > 4{
  26. linksNum = 4
  27. }
  28. for i in 0..<linksNum{
  29. let vview : UIView = imgBackViewList[i]
  30. vview.isHidden = false
  31. let foodImg = foodImgList[i]
  32. foodImg.sd_setImage(url: URL.init(string: model.links![i] ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
  33. }
  34. self.headImg.sd_setImage(url: URL.init(string: model.avatar ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
  35. self.nameLab.text = "\(model.name ?? "")"
  36. self.timeLab.text = "\(model.praiseTime ?? "")"
  37. }
  38. }