IHActivityHistoryCell.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // IHActivityHistoryCell.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/19.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHActivityHistoryCell: UITableViewCell {
  10. @IBOutlet weak var nameLabelWidth: NSLayoutConstraint!
  11. var log: LogData?{
  12. didSet{
  13. if let log = self.log {
  14. nameLabel.text = log.name
  15. let width = log.name?.ga_widthForComment(font: UIFont(name: PingFangSC_Medium, size: 14)!, height: 20)
  16. nameLabelWidth.constant = width! + 10
  17. activityType.text = log.activites
  18. floorLabel.text = "\(log.floor!)-\(log.room!)"
  19. descriptionLabel.text = log.description
  20. timeLabel.text = log.time
  21. if log.userId == AppShare.mLoginData?.id {
  22. iconImageV.image = UIImage(named: "日志记录_绿")
  23. }else{
  24. iconImageV.image = UIImage(named: "日志记录_灰")
  25. }
  26. }
  27. }
  28. }
  29. // var status:Bool?{
  30. // didSet{
  31. // if let status = self.status {
  32. // iconImageV.image = status == true ? UIImage(named: "日志记录_绿") : UIImage(named: "日志记录_灰")
  33. // }
  34. // }
  35. // }
  36. @IBOutlet weak var iconImageV: UIImageView!
  37. @IBOutlet weak var nameLabel: UILabel!
  38. @IBOutlet weak var activityType: UILabel!
  39. @IBOutlet weak var floorLabel: UILabel!
  40. @IBOutlet weak var descriptionLabel: UILabel!
  41. @IBOutlet weak var timeLabel: UILabel!
  42. override func awakeFromNib() {
  43. super.awakeFromNib()
  44. // Initialization code
  45. let lineView = IHDashView(strokeColor: UIColor(hexString: "C6CDD5", transparency: 0.5)?.cgColor, gap: 3, lineWith: 1)
  46. lineView.frame = CGRect(x: 20, y: bounds.size.height - 1, width: KSCREENWIDTH - 40 , height: 1)
  47. addSubview(lineView)
  48. }
  49. override func setSelected(_ selected: Bool, animated: Bool) {
  50. super.setSelected(selected, animated: animated)
  51. // Configure the view for the selected state
  52. }
  53. }