react-native-navigation的迁移库

RNNSplitViewController.m 1.1KB

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