1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #import "RNNSideMenuChildVC.h"
-
- @interface RNNSideMenuChildVC ()
-
- @property (readwrite) RNNSideMenuChildType type;
- @property (nonatomic, retain) UIViewController<RNNParentProtocol> *child;
-
- @end
-
- @implementation RNNSideMenuChildVC
-
- - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options optionsResolver:(RNNParentOptionsResolver *)optionsResolver presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type {
- self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options optionsResolver:optionsResolver presenter:presenter];
-
- self.type = type;
-
- return self;
- }
-
- - (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 bindChildViewControllers:childViewControllers];
-
- return self;
- }
-
- - (void)bindChildViewControllers:(NSArray<UIViewController<RNNParentProtocol> *> *)viewControllers {
- UIViewController<RNNParentProtocol>* child = viewControllers[0];
-
- self.child = child;
- [self addChildViewController:self.child];
- [self.child.view setFrame:self.view.bounds];
- [self.view addSubview:self.child.view];
- [self.view bringSubviewToFront:self.child.view];
- }
-
- - (UIViewController *)getLeafViewController {
- return [self.child getLeafViewController];
- }
-
- - (void)willMoveToParentViewController:(UIViewController *)parent {
- [_optionsResolver resolve:self with:self.childViewControllers];
- [_presenter present:self.options onViewControllerDidLoad:self];
- }
-
- - (void)mergeOptions:(RNNNavigationOptions *)options {
- [self.options mergeOptions:options overrideOptions:YES];
- [self.presenter present:self.options onViewControllerWillAppear:self];
- }
-
- - (UIStatusBarStyle)preferredStatusBarStyle {
- return self.child.preferredStatusBarStyle;
- }
-
- @end
|