react-native-navigation的迁移库

RNNExternalViewController.m 1.2KB

12345678910111213141516171819202122232425262728293031323334
  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. @end