12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #import "RNNSplitViewController.h"
-
- @implementation RNNSplitViewController
-
- - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter {
- self = [super init];
-
- self.presenter = presenter;
- self.options = options;
- self.layoutInfo = layoutInfo;
- self.optionsResolver = optionsResolver;
-
- self.navigationController.delegate = self;
-
- [self bindChildViewControllers:childViewControllers];
-
- return self;
- }
-
- - (void)bindChildViewControllers:(NSArray<UIViewController<RNNLayoutProtocol> *> *)viewControllers {
- [self setViewControllers:viewControllers];
- UIViewController<UISplitViewControllerDelegate>* masterViewController = viewControllers[0];
- self.delegate = masterViewController;
- }
-
- -(void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.options applyOn:self];
- }
-
- - (UIViewController *)getLeafViewController {
- return self;
- }
-
- - (void)willMoveToParentViewController:(UIViewController *)parent {
- [_optionsResolver resolve:self with:self.viewControllers];
- [_presenter present:self.options onViewControllerDidLoad:self];
- }
-
- - (void)mergeOptions:(RNNNavigationOptions *)options {
- [self.options mergeOptions:options overrideOptions:YES];
- [self.presenter present:self.options onViewControllerWillAppear:self];
- }
-
- @end
|