// // IHClassGatewayManager.swift // Inhealth // // Created by weclouds on 2020/8/19. // Copyright © 2020 weclouds. All rights reserved. // import UIKit class IHClassGatewayManager: NSObject { private weak var vc : IHClassGatewayCtr? let classNaviCtr = IHNavigationController() let gatewayNaviCtr = IHNavigationController() private lazy var mainView : IHClassGatewayView = { let mainView = IHClassGatewayView.init(frame: CGRect.init(x: 0, y: 0, width: KSCREENWIDTH, height: KSCREENHEIGHT)) mainView.delete = self return mainView }() func bindController(_ vc : IHClassGatewayCtr) { self.vc = vc self.vc?.view.addSubview(mainView) //添加二个控制器 addChildController() } } extension IHClassGatewayManager{ private func addChildController(){ let classCtr = IHClassControlCtr() classNaviCtr.addChild(classCtr) self.vc?.addChild(classNaviCtr) let gatewayCtr = IHGatewayCtr() gatewayNaviCtr.addChild(gatewayCtr) self.vc?.addChild(gatewayNaviCtr) classCtr.viewH = mainView.contentView!.height classCtr.gatewayList = self.vc?.gatewayList classCtr.view.frame.size.height = mainView.contentView!.height classCtr.bottomView = self.mainView.bottomView classNaviCtr.view.frame.size.height = mainView.contentView!.height gatewayCtr.bottomView = self.mainView.bottomView gatewayCtr.gatewayList = self.vc?.gatewayList gatewayCtr.viewH = mainView.contentView!.height gatewayCtr.view.frame.size.height = mainView.contentView!.height gatewayNaviCtr.view.frame.size.height = mainView.contentView!.height mainView.contentView!.addSubview(classNaviCtr.view) } } extension IHClassGatewayManager: IHClassGatewayViewDelete{ func changeCtr(tag : Int) { //tag = 1 if tag == 1{ // self.vc?.view.backgroundColor = .black self.vc?.transition(from: gatewayNaviCtr, to: classNaviCtr, duration: 0.1, options: [], animations: nil, completion: nil) }else{ // self.vc?.view.backgroundColor = .white self.vc?.transition(from: classNaviCtr, to: gatewayNaviCtr, duration: 0.1, options: [], animations: nil, completion: nil) } } }