IHClassGatewayManager.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // IHClassGatewayManager.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2020/8/19.
  6. // Copyright © 2020 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHClassGatewayManager: NSObject {
  10. private weak var vc : IHClassGatewayCtr?
  11. let classNaviCtr = IHNavigationController()
  12. let gatewayNaviCtr = IHNavigationController()
  13. private lazy var mainView : IHClassGatewayView = {
  14. let mainView = IHClassGatewayView.init(frame: CGRect.init(x: 0, y: 0, width: KSCREENWIDTH, height: KSCREENHEIGHT))
  15. mainView.delete = self
  16. return mainView
  17. }()
  18. func bindController(_ vc : IHClassGatewayCtr) {
  19. self.vc = vc
  20. self.vc?.view.addSubview(mainView)
  21. //添加二个控制器
  22. addChildController()
  23. }
  24. }
  25. extension IHClassGatewayManager{
  26. private func addChildController(){
  27. let classCtr = IHClassControlCtr()
  28. classNaviCtr.addChild(classCtr)
  29. self.vc?.addChild(classNaviCtr)
  30. let gatewayCtr = IHGatewayCtr()
  31. gatewayNaviCtr.addChild(gatewayCtr)
  32. self.vc?.addChild(gatewayNaviCtr)
  33. classCtr.viewH = mainView.contentView!.height
  34. classCtr.gatewayList = self.vc?.gatewayList
  35. classCtr.view.frame.size.height = mainView.contentView!.height
  36. classCtr.bottomView = self.mainView.bottomView
  37. classNaviCtr.view.frame.size.height = mainView.contentView!.height
  38. gatewayCtr.bottomView = self.mainView.bottomView
  39. gatewayCtr.gatewayList = self.vc?.gatewayList
  40. gatewayCtr.viewH = mainView.contentView!.height
  41. gatewayCtr.view.frame.size.height = mainView.contentView!.height
  42. gatewayNaviCtr.view.frame.size.height = mainView.contentView!.height
  43. mainView.contentView!.addSubview(classNaviCtr.view)
  44. }
  45. }
  46. extension IHClassGatewayManager: IHClassGatewayViewDelete{
  47. func changeCtr(tag : Int) {
  48. //tag = 1
  49. if tag == 1{
  50. // self.vc?.view.backgroundColor = .black
  51. self.vc?.transition(from: gatewayNaviCtr, to: classNaviCtr, duration: 0.1, options: [], animations: nil, completion: nil)
  52. }else{
  53. // self.vc?.view.backgroundColor = .white
  54. self.vc?.transition(from: classNaviCtr, to: gatewayNaviCtr, duration: 0.1, options: [], animations: nil, completion: nil)
  55. }
  56. }
  57. }