BindCheckView.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // BindCheckView.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/3/27.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class BindCheckView: UIView {
  10. @IBOutlet weak var imgState: UIImageView!
  11. @IBOutlet weak var viewContent: UIView!
  12. @IBOutlet weak var btnConfrim: UIButton!
  13. @IBOutlet weak var lblRemark: UILabel!
  14. var reState = 0
  15. var commonBackFunc: RebackFunction!
  16. ///state 0 不符合规则 1:符合规则
  17. func initView(state: Int, backFunc:@escaping RebackFunction) {
  18. reState = state
  19. commonBackFunc = backFunc
  20. viewContent.setCornerRadius(size: 8)
  21. if state == 0 {
  22. imgState.image = UIImage(named: "ion_opening_merchants_11")
  23. lblRemark.text = "抱歉,根据绑定规则,该机具不在您可绑定的范围内!"
  24. lblRemark.textColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xff4e4e, alpha: 1.0)
  25. btnConfrim.setBackgroundImage(UIImage(named: "btn_opening_merchants_01"), for: .normal)
  26. } else {
  27. imgState.image = UIImage(named: "ion_opening_merchants_10")
  28. lblRemark.text = "已成功绑定该机具!"
  29. lblRemark.textColor = CommonUntils.getUIColorFromRGB(rgbValue: 0x666666, alpha: 1.0)
  30. btnConfrim.setBackgroundImage(UIImage(named: "btn_opening_merchants_02"), for: .normal)
  31. }
  32. }
  33. @IBAction func btnConfrimClick(_ sender: Any) {
  34. commonBackFunc!(reState, "")
  35. }
  36. }