IHEquipmentCell.swift 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // IHEquipmentCell.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/11.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHEquipmentCell: UITableViewCell {
  10. var model :EquipmentViewCellModel?{
  11. didSet{
  12. if let model = self.model {
  13. if let icon = model.icon,let title = model.title,let value = model.value,let isAlert = model.isAlert {
  14. iconImageV.image = UIImage(named: icon )
  15. titleLabel.text = title
  16. valueLabel.text = value
  17. if isAlert == true {
  18. self.contentView.backgroundColor = UIColor(hexString: "#FFF3F3")
  19. self.valueLabel.textColor = UIColor(hexString: "#FF0C4D")
  20. }else{
  21. self.contentView.backgroundColor = UIColor(hexString: "#F6F8F7")
  22. self.valueLabel.textColor = UIColor(hexString: "#333333")
  23. }
  24. }
  25. }
  26. }
  27. }
  28. @IBOutlet weak var iconImageV: UIImageView!
  29. @IBOutlet weak var titleLabel: UILabel!
  30. @IBOutlet weak var valueLabel: UILabel!
  31. override func awakeFromNib() {
  32. super.awakeFromNib()
  33. // Initialization code
  34. }
  35. override func setSelected(_ selected: Bool, animated: Bool) {
  36. super.setSelected(selected, animated: animated)
  37. // Configure the view for the selected state
  38. }
  39. override var frame: CGRect{
  40. set(newFrame){
  41. var frame = newFrame
  42. frame.origin.x = frame.origin.x + 20 //递归
  43. frame.origin.y = frame.origin.y + 5
  44. frame.size.width -= 40
  45. frame.size.height -= 10
  46. super.frame = frame
  47. }
  48. get{
  49. return super.frame
  50. }
  51. }
  52. }