BaseSlideSegmentViewChildViewController.swift 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. func slideSegmentViewChildViewController(present viewController: UIViewController)
  17. }
  18. // MARK: - SlideSegmentViewChildViewControllerDelegate默认实现
  19. extension UIViewController: SlideSegmentViewChildViewControllerDelegate {
  20. func slideSegmentViewChildViewController(present viewController: UIViewController) {
  21. self.present(viewController, animated: true, completion: nil)
  22. }
  23. func slideSegmentViewChildViewController(push viewController: UIViewController) {
  24. self.navigationController?.pushViewController(viewController, animated: true)
  25. }
  26. }
  27. // BaseSlideSegmentViewChildViewController
  28. class BaseSlideSegmentViewChildViewController<M: Any>: BaseTableViewController<M> {
  29. weak var delegate: SlideSegmentViewChildViewControllerDelegate?
  30. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  31. }
  32. }
  33. // BaseSlideSegmentViewChildViewController
  34. class BaseGroupedSlideSegmentViewChildViewController<M: Any>: GroupedTableViewController<M> {
  35. weak var delegate: SlideSegmentViewChildViewControllerDelegate?
  36. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  37. }
  38. }