react-native-navigation的迁移库

RNNSideMenuChildVC.m 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // RNNSideMenuChildVC.m
  3. // ReactNativeNavigation
  4. //
  5. // Created by Ran Greenberg on 09/02/2017.
  6. // Copyright © 2017 Wix. All rights reserved.
  7. //
  8. #import "RNNSideMenuChildVC.h"
  9. @interface RNNSideMenuChildVC ()
  10. @property (readwrite) RNNSideMenuChildType type;
  11. @property (readwrite) UIViewController<RNNParentProtocol> *child;
  12. @end
  13. @implementation RNNSideMenuChildVC
  14. -(instancetype) initWithChild:(UIViewController<RNNParentProtocol>*)child type:(RNNSideMenuChildType)type {
  15. self = [super init];
  16. self.child = child;
  17. [self addChildViewController:self.child];
  18. [self.child.view setFrame:self.view.bounds];
  19. [self.view addSubview:self.child.view];
  20. [self.view bringSubviewToFront:self.child.view];
  21. self.type = type;
  22. return self;
  23. }
  24. - (UIViewController *)getLeafViewController {
  25. return [self.child getLeafViewController];
  26. }
  27. - (void)performOnChildWillAppear:(RNNNavigationOptions *)childOptions {
  28. RNNNavigationOptions* combinedOptions = [_presenter presentWithChildOptions:childOptions on:self];
  29. if ([self.parentViewController respondsToSelector:@selector(performOnChildWillAppear:)]) {
  30. [self.parentViewController performSelector:@selector(performOnChildWillAppear:) withObject:combinedOptions];
  31. }
  32. }
  33. - (void)performOnChildLoad:(RNNNavigationOptions *)childOptions {
  34. RNNNavigationOptions* combinedOptions = [_presenter presentWithChildOptions:childOptions on:self];
  35. if ([self.parentViewController respondsToSelector:@selector(performOnChildLoad:)]) {
  36. [self.parentViewController performSelector:@selector(performOnChildLoad:) withObject:combinedOptions];
  37. }
  38. }
  39. - (void)willMoveToParentViewController:(UIViewController *)parent {
  40. if ([self.parentViewController respondsToSelector:@selector(performOnChildLoad:)]) {
  41. [self.parentViewController performSelector:@selector(performOnChildLoad:) withObject:_presenter.options];
  42. }
  43. }
  44. - (UIStatusBarStyle)preferredStatusBarStyle {
  45. return self.child.preferredStatusBarStyle;
  46. }
  47. @end