react-native-navigation的迁移库

RNNSplitViewController.m 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #import "RNNSplitViewController.h"
  2. @implementation RNNSplitViewController
  3. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNViewControllerPresenter *)presenter {
  4. self = [super init];
  5. self.presenter = presenter;
  6. [self.presenter bindViewController:self];
  7. self.options = options;
  8. self.layoutInfo = layoutInfo;
  9. self.navigationController.delegate = self;
  10. [self bindChildViewControllers:childViewControllers];
  11. return self;
  12. }
  13. - (void)onChildWillAppear {
  14. [_presenter applyOptions:self.resolveOptions];
  15. [((UIViewController<RNNParentProtocol> *)self.parentViewController) onChildWillAppear];
  16. }
  17. - (RNNNavigationOptions *)resolveOptions {
  18. return (RNNNavigationOptions *)[self.getCurrentChild.resolveOptions.copy mergeOptions:self.options];
  19. }
  20. - (void)mergeOptions:(RNNNavigationOptions *)options {
  21. [_presenter mergeOptions:options resolvedOptions:self.resolveOptions];
  22. [((UIViewController<RNNLayoutProtocol> *)self.parentViewController) mergeOptions:options];
  23. }
  24. - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
  25. [self setViewControllers:viewControllers];
  26. UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];
  27. self.delegate = masterViewController;
  28. }
  29. -(void)viewWillAppear:(BOOL)animated{
  30. [super viewWillAppear:animated];
  31. }
  32. - (UIViewController *)getCurrentChild {
  33. return self;
  34. }
  35. @end