OutInMoneyViewController.swift 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // OutInMoneyViewController.swift
  3. // MTP2_iOS
  4. //
  5. // Created by zhongyuan on 2018/3/22.
  6. // Copyright © 2018年 zhongyuan.All rights reserved.
  7. //
  8. import UIKit
  9. /// 出入金视图容器控制类
  10. class OutInMoneyViewController: BaseViewController {
  11. // MARK: - 属性列表
  12. let titles:[String] = ["出金", "出入金查询"]
  13. var viewControllers = [UIViewController]()
  14. var viewControllersID:[String] = []
  15. @IBOutlet weak var slideSegmentView: SlideSegmentView!
  16. var _delegates: [PageChangeDelegate] = []
  17. // MARK: - 生命周期
  18. override func viewDidLoad() {
  19. super.viewDidLoad()
  20. viewControllersID = ["OutMoneyViewID", "OutInQueryViewID"] /// 中远等版本
  21. slideSegmentView.titles = titles
  22. for (index,id) in viewControllersID.enumerated() {
  23. if var viweController = (UIStoryboard(name: "OutInMoney", bundle: nil).instantiateViewController(withIdentifier: id)) as? PageChangeDelegate {
  24. viweController.pageIndex = index
  25. _delegates.append(viweController)
  26. viewControllers.append(viweController as! UIViewController)
  27. }
  28. }
  29. slideSegmentView.viewControllers = viewControllers
  30. slideSegmentView.didScrollToIndex = {[unowned self] index in
  31. for delegate in self._delegates {
  32. if delegate.pageIndex == self.slideSegmentView.curPageIndex {
  33. delegate.didHide()
  34. }
  35. if delegate.pageIndex == index {
  36. delegate.didShow()
  37. }
  38. }
  39. }
  40. loadData()
  41. _delegates[0].didShow()
  42. }
  43. override func viewWillAppear(_ animated: Bool) {
  44. super.viewWillAppear(animated)
  45. /// 显示导航栏
  46. self.navigationController?.setNavigationBarHidden(false, animated: true)
  47. /// 默认滚动
  48. self.slideSegmentView.setPageIndex(pageIndex: (self.takeInfo as? Int) ?? 0, animated: true)
  49. }
  50. override func viewWillDisappear(_ animated: Bool) {
  51. super.viewWillDisappear(animated)
  52. NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
  53. }
  54. /// 加载托管银行信息
  55. func loadData() {
  56. guard let bankManager = MTP2BusinessCore.shared.bankManager else { return }
  57. bankManager.queryBankCusBankInfo(callback: { (_, _, _) in })
  58. }
  59. }