react-native-navigation的迁移库

RNNSideMenuChildVC.m 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #import "RNNSideMenuChildVC.h"
  2. @interface RNNSideMenuChildVC ()
  3. @property (readwrite) RNNSideMenuChildType type;
  4. @property (nonatomic, retain) UIViewController<RNNParentProtocol> *child;
  5. @end
  6. @implementation RNNSideMenuChildVC
  7. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter type:(RNNSideMenuChildType)type {
  8. self = [self initWithLayoutInfo:layoutInfo childViewControllers:childViewControllers options:options presenter:presenter];
  9. self.type = type;
  10. return self;
  11. }
  12. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options presenter:(RNNBasePresenter *)presenter {
  13. self = [super init];
  14. self.presenter = presenter;
  15. self.options = options;
  16. self.layoutInfo = layoutInfo;
  17. [self bindChildViewControllers:childViewControllers];
  18. return self;
  19. }
  20. - (void)bindChildViewControllers:(NSArray<UIViewController<RNNParentProtocol> *> *)viewControllers {
  21. UIViewController<RNNParentProtocol>* child = viewControllers[0];
  22. self.child = child;
  23. [self addChildViewController:self.child];
  24. [self.child.view setFrame:self.view.bounds];
  25. [self.view addSubview:self.child.view];
  26. [self.view bringSubviewToFront:self.child.view];
  27. }
  28. - (UIViewController *)getLeafViewController {
  29. return [self.child getLeafViewController];
  30. }
  31. - (void)willMoveToParentViewController:(UIViewController *)parent {
  32. [_presenter present:self.options onViewControllerDidLoad:self];
  33. }
  34. - (UIStatusBarStyle)preferredStatusBarStyle {
  35. return self.child.preferredStatusBarStyle;
  36. }
  37. @end