IdentitySelectView.swift 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // IdentitySelectView.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2020/8/5.
  6. // Copyright © 2020 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class IdentitySelectView: UIView {
  10. @IBOutlet weak var identityLabel: UILabel!
  11. @IBOutlet weak var identityUnitLabel: UILabel!
  12. @IBOutlet weak var selectedImageView: UIImageView!
  13. var selected = false
  14. var id : IdentityV2? = nil
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. }
  18. func setUp(identity: IdentityV2) {
  19. self.id = identity
  20. self.identityLabel.text = "\(identity.name ?? "")(\(identity.unitName ?? ""))"
  21. self.identityLabel.textColor = text_primary_color
  22. self.identityUnitLabel.text = "\(identity.unitLevelName ?? "")"
  23. self.identityUnitLabel.textColor = text_normal_color
  24. self.backgroundColor = .white
  25. }
  26. func selectedIdentity() {
  27. self.selected = true
  28. self.identityLabel.textColor = base_color
  29. self.selectedImageView.isHidden = false
  30. }
  31. func deSelectedIdentity() {
  32. self.selected = false
  33. self.identityLabel.textColor = text_primary_color
  34. self.selectedImageView.isHidden = true
  35. }
  36. }