OutInMoneyViewController.swift 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. /// 中远等版本
  21. viewControllersID = ["OutMoneyViewID", "OutInQueryViewID"]
  22. slideSegmentView.titles = titles
  23. for (index,id) in viewControllersID.enumerated() {
  24. if var viweController = (UIStoryboard(name: "OutInMoney", bundle: nil).instantiateViewController(withIdentifier: id)) as? PageChangeDelegate {
  25. viweController.pageIndex = index
  26. _delegates.append(viweController)
  27. viewControllers.append(viweController as! UIViewController)
  28. }
  29. }
  30. slideSegmentView.viewControllers = viewControllers
  31. slideSegmentView.didScrollToIndex = {[unowned self] index in
  32. for delegate in self._delegates {
  33. if delegate.pageIndex == self.slideSegmentView.curPageIndex {
  34. delegate.didHide()
  35. }
  36. if delegate.pageIndex == index {
  37. delegate.didShow()
  38. }
  39. }
  40. }
  41. loadData()
  42. _delegates[0].didShow()
  43. }
  44. override func viewWillAppear(_ animated: Bool) {
  45. super.viewWillAppear(animated)
  46. /// 显示导航栏
  47. self.navigationController?.setNavigationBarHidden(false, animated: true)
  48. /// 默认滚动
  49. self.slideSegmentView.setPageIndex(pageIndex: (self.takeInfo as? Int) ?? 0, animated: true)
  50. }
  51. override func viewWillDisappear(_ animated: Bool) {
  52. super.viewWillDisappear(animated)
  53. NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
  54. }
  55. /// 加载托管银行信息
  56. func loadData() {
  57. guard let bankManager = MTP2BusinessCore.shared.bankManager else { return }
  58. bankManager.queryBankCusBankInfo(callback: { (_, _, _) in })
  59. }
  60. }