BusinessHeaderView.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // BusinessHeaderView.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/3/22.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. @objc protocol BusinessHeaderViewDelegate {
  10. func segmentDidClickedWithIndex(index: NSInteger)
  11. }
  12. class BusinessHeaderView: UIView {
  13. @IBOutlet weak var viewContent1: UIView!
  14. @IBOutlet weak var viewContent2: UIView!
  15. @IBOutlet weak var viewMenu1: UIView!
  16. @IBOutlet weak var viewMenu2: UIView!
  17. @IBOutlet weak var viewMenu3: UIView!
  18. @IBOutlet weak var viewMenu4: UIView!
  19. @IBOutlet weak var viewLine1: UIView!
  20. @IBOutlet weak var viewLine2: UIView!
  21. @IBOutlet weak var viewLine3: UIView!
  22. weak open var delegate: BusinessHeaderViewDelegate?
  23. var selectedIndex = 0
  24. func initView() {
  25. self.setSizeWidth(width: ScreenWidth)
  26. viewLine1.setSizeHeight(height: 1.5)
  27. viewLine2.setSizeWidth(width: 1.5)
  28. viewLine3.setSizeWidth(width: 1.5)
  29. CommonViewUntils.setViewAverage(arrView: [viewMenu1!, viewMenu2!], marginLeft: 15, marginRight: 5, between: 5)
  30. CommonViewUntils.setViewAverage(arrView: [viewMenu3!, viewMenu4!], marginLeft: 15, marginRight: 5, between: 5)
  31. let sgment = XF_Segment.init(frame: CGRect.init(x: 0, y: 53, width: ScreenWidth, height: 50), titles: ["海付POS机", "海付传统POS", "海科传统POS(山东河南)", "快益刷传统POS"], selectedIndex: selectedIndex, defaultColor: CommonUntils.getUIColorFromRGB(rgbValue: 0x333333), selectedColor: CommonUntils.getUIColorFromRGB(rgbValue: 0x2094f5)) { [weak self](index) in
  32. self!.selectedIndex = index
  33. self!.delegate?.segmentDidClickedWithIndex(index: index)
  34. }
  35. self.viewContent2.addSubview(sgment)
  36. }
  37. //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
  38. @IBAction func btnMenuClick(_ sender: AnyObject) {
  39. switch (sender as! UIButton).tag {
  40. case 1001: // 我的代理
  41. appDelegate.navController.pushViewController(MyDelegateViewController(), animated: true)
  42. break
  43. case 1002: // 我的商户
  44. let vc = MyShopListViewController()
  45. appDelegate.navController.pushViewController(vc, animated: true)
  46. break
  47. case 1003: // 交易管理
  48. appDelegate.navController.pushViewController(TradeViewController(), animated: true)
  49. break
  50. case 1004: // 终端管理
  51. appDelegate.navController.pushViewController(MachineManagerViewController(), animated: true)
  52. break
  53. case 1005: //
  54. break
  55. case 1006: //
  56. break
  57. default:
  58. break
  59. }
  60. }
  61. }