BaseSlideSegmentViewChildViewController.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // BaseSlideSegmentViewChildViewController.swift
  3. // MTP2_iOS
  4. //
  5. // Created by zhongyuan on 2018/4/4.
  6. // Copyright © 2018年 zhongyuan.All rights reserved.
  7. //
  8. import UIKit
  9. protocol SlideSegmentViewChildViewControllerDelegate: BaseProtocal {
  10. /// 自身没有navigationController,所以找父级控制器帮他push
  11. ///
  12. /// - Parameters:
  13. /// - sender: 成交单控制器
  14. /// - viewController: 需要push的页面
  15. func slideSegmentViewChildViewController(push viewController: UIViewController)
  16. /// slideSegmentViewChildViewController
  17. /// - Parameter viewController: viewController
  18. func slideSegmentViewChildViewController(present viewController: UIViewController)
  19. }
  20. // MARK: - SlideSegmentViewChildViewControllerDelegate默认实现
  21. extension UIViewController: SlideSegmentViewChildViewControllerDelegate {
  22. func slideSegmentViewChildViewController(present viewController: UIViewController) {
  23. self.present(viewController, animated: true, completion: nil)
  24. }
  25. func slideSegmentViewChildViewController(push viewController: UIViewController) {
  26. self.navigationController?.pushViewController(viewController, animated: true)
  27. }
  28. }
  29. // BaseSlideSegmentViewChildViewController
  30. class BaseSlideSegmentViewChildViewController<M: Any>: BaseTableViewController<M> {
  31. weak var delegate: SlideSegmentViewChildViewControllerDelegate?
  32. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {}
  33. }
  34. // BaseSlideSegmentViewChildViewController
  35. class BaseGroupedSlideSegmentViewChildViewController<M: Any>: GroupedTableViewController<M> {
  36. weak var delegate: SlideSegmentViewChildViewControllerDelegate?
  37. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {}
  38. }