react-native-navigation的迁移库

RNNSplitViewController.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #import "RNNSplitViewController.h"
  2. @implementation RNNSplitViewController
  3. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
  4. self = [super init];
  5. self.presenter = presenter;
  6. self.options = options;
  7. self.layoutInfo = layoutInfo;
  8. self.optionsResolver = optionsResolver;
  9. self.navigationController.delegate = self;
  10. [self bindChildViewControllers:childViewControllers];
  11. return self;
  12. }
  13. - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
  14. [self setViewControllers:viewControllers];
  15. UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];
  16. self.delegate = masterViewController;
  17. }
  18. -(void)viewWillAppear:(BOOL)animated{
  19. [super viewWillAppear:animated];
  20. [self.options applyOn:self];
  21. }
  22. - (UIViewController *)getLeafViewController {
  23. return self;
  24. }
  25. - (void)willMoveToParentViewController:(UIViewController *)parent {
  26. [_optionsResolver resolve:self with:self.viewControllers];
  27. [_presenter present:self.options onViewControllerDidLoad:self];
  28. }
  29. - (void)mergeOptions:(RNNNavigationOptions *)options {
  30. [self.options mergeOptions:options overrideOptions:YES];
  31. [self.presenter present:self.options onViewControllerWillAppear:self];
  32. }
  33. @end