PosHeaderView.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // PosHeaderView.swift
  3. // xingchuangke
  4. //
  5. // Created by 李晓飞 on 2020/9/6.
  6. // Copyright © 2020 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. @objc protocol PosHeaderViewDelegate {
  10. func selectBtnClicked(selected: Bool, snIdStr: NSString)
  11. // func flodBtnClicked(selected: Bool)
  12. }
  13. typealias FlodBlock = () -> Void
  14. class PosHeaderView: UIView {
  15. weak var delegate: PosHeaderViewDelegate?
  16. @IBOutlet weak var selectBtn: UIButton!
  17. @IBOutlet weak var snLabel: UILabel!
  18. @IBOutlet weak var foldImgV: UIImageView!
  19. @IBOutlet weak var statusLabel: UILabel!
  20. var flodBlock: FlodBlock?
  21. var snId: String = ""
  22. @IBAction func selectBtnClick(_ sender: Any) {
  23. let btn = (sender as! UIButton)
  24. btn.isSelected = !btn.isSelected
  25. // let str = snLabel.text?.substringFrom(index: 4)
  26. self.delegate?.selectBtnClicked(selected: btn.isSelected, snIdStr: snId as NSString)
  27. }
  28. @IBAction func flodBtnClick(_ sender: Any) {
  29. let btn = (sender as! UIButton)
  30. btn.isSelected = !btn.isSelected
  31. if flodBlock != nil {
  32. flodBlock!()
  33. }
  34. }
  35. /*
  36. // Only override draw() if you perform custom drawing.
  37. // An empty implementation adversely affects performance during animation.
  38. override func draw(_ rect: CGRect) {
  39. // Drawing code
  40. }
  41. */
  42. }