react-native-navigation的迁移库

RNNExternalViewController.m 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #import "RNNExternalViewController.h"
  2. @implementation RNNExternalViewController {
  3. UIViewController* _boundViewController;
  4. }
  5. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNComponentPresenter *)presenter options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions viewController:(UIViewController *)viewController {
  6. _boundViewController = viewController;
  7. self = [super initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:eventEmitter presenter:presenter options:options defaultOptions:defaultOptions];
  8. [self bindViewController:viewController];
  9. return self;
  10. }
  11. - (void)bindViewController:(UIViewController *)viewController {
  12. _boundViewController = viewController;
  13. [self addChildViewController:viewController];
  14. [self.view addSubview:viewController.view];
  15. [viewController didMoveToParentViewController:self];
  16. }
  17. - (UINavigationItem *)navigationItem {
  18. return _boundViewController.navigationItem;
  19. }
  20. - (void)loadView {
  21. self.view = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
  22. }
  23. - (void)render {
  24. [self readyForPresentation];
  25. }
  26. # pragma mark - UIViewController overrides
  27. - (void)willMoveToParentViewController:(UIViewController *)parent {
  28. [self.presenter willMoveToParentViewController:parent];
  29. }
  30. - (UIStatusBarStyle)preferredStatusBarStyle {
  31. return [self.presenter getStatusBarStyle];
  32. }
  33. - (BOOL)prefersStatusBarHidden {
  34. return [self.presenter getStatusBarVisibility];
  35. }
  36. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  37. return [self.presenter getOrientation];
  38. }
  39. - (BOOL)hidesBottomBarWhenPushed {
  40. return [self.presenter hidesBottomBarWhenPushed];
  41. }
  42. @end