123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // BusinessHeaderView.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/3/22.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- @objc protocol BusinessHeaderViewDelegate {
- func segmentDidClickedWithIndex(index: NSInteger)
- }
- class BusinessHeaderView: UIView {
- @IBOutlet weak var viewContent1: UIView!
- @IBOutlet weak var viewContent2: UIView!
- @IBOutlet weak var viewMenu1: UIView!
- @IBOutlet weak var viewMenu2: UIView!
- @IBOutlet weak var viewMenu3: UIView!
- @IBOutlet weak var viewMenu4: UIView!
- @IBOutlet weak var viewLine1: UIView!
- @IBOutlet weak var viewLine2: UIView!
- @IBOutlet weak var viewLine3: UIView!
- weak open var delegate: BusinessHeaderViewDelegate?
- var selectedIndex = 0
- func initView() {
- self.setSizeWidth(width: ScreenWidth)
- viewLine1.setSizeHeight(height: 1.5)
- viewLine2.setSizeWidth(width: 1.5)
- viewLine3.setSizeWidth(width: 1.5)
- CommonViewUntils.setViewAverage(arrView: [viewMenu1!, viewMenu2!], marginLeft: 15, marginRight: 5, between: 5)
- CommonViewUntils.setViewAverage(arrView: [viewMenu3!, viewMenu4!], marginLeft: 15, marginRight: 5, between: 5)
- 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
- self!.selectedIndex = index
- self!.delegate?.segmentDidClickedWithIndex(index: index)
- }
- self.viewContent2.addSubview(sgment)
- }
- //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
- @IBAction func btnMenuClick(_ sender: AnyObject) {
- switch (sender as! UIButton).tag {
- case 1001: // 我的代理
- appDelegate.navController.pushViewController(MyDelegateViewController(), animated: true)
- break
- case 1002: // 我的商户
- let vc = MyShopListViewController()
- appDelegate.navController.pushViewController(vc, animated: true)
- break
- case 1003: // 交易管理
- appDelegate.navController.pushViewController(TradeViewController(), animated: true)
- break
- case 1004: // 终端管理
- appDelegate.navController.pushViewController(MachineManagerViewController(), animated: true)
- break
- case 1005: //
- break
- case 1006: //
- break
- default:
- break
- }
- }
- }
|