// // OutInMoneyViewController.swift // MTP2_iOS // // Created by zhongyuan on 2018/3/22. // Copyright © 2018年 zhongyuan.All rights reserved. // import UIKit /// 出入金视图容器控制类 class OutInMoneyViewController: BaseViewController { // MARK: - 属性列表 let titles:[String] = ["出金", "出入金查询"] var viewControllers = [UIViewController]() var viewControllersID:[String] = [] @IBOutlet weak var slideSegmentView: SlideSegmentView! var _delegates: [PageChangeDelegate] = [] // MARK: - 生命周期 override func viewDidLoad() { super.viewDidLoad() viewControllersID = ["OutMoneyViewID", "OutInQueryViewID"] /// 中远等版本 slideSegmentView.titles = titles for (index,id) in viewControllersID.enumerated() { if var viweController = (UIStoryboard(name: "OutInMoney", bundle: nil).instantiateViewController(withIdentifier: id)) as? PageChangeDelegate { viweController.pageIndex = index _delegates.append(viweController) viewControllers.append(viweController as! UIViewController) } } slideSegmentView.viewControllers = viewControllers slideSegmentView.didScrollToIndex = {[unowned self] index in for delegate in self._delegates { if delegate.pageIndex == self.slideSegmentView.curPageIndex { delegate.didHide() } if delegate.pageIndex == index { delegate.didShow() } } } loadData() _delegates[0].didShow() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) /// 显示导航栏 self.navigationController?.setNavigationBarHidden(false, animated: true) /// 默认滚动 self.slideSegmentView.setPageIndex(pageIndex: (self.takeInfo as? Int) ?? 0, animated: true) } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) } /// 加载托管银行信息 func loadData() { guard let bankManager = MTP2BusinessCore.shared.bankManager else { return } bankManager.queryBankCusBankInfo(callback: { (_, _, _) in }) } }