react-native-navigation的迁移库

RNNSideMenuChildVC.m 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #import "RNNSideMenuChildVC.h"
  2. #import "UIViewController+LayoutProtocol.h"
  3. @interface RNNSideMenuChildVC ()
  4. @property (readwrite) RNNSideMenuChildType type;
  5. @property (nonatomic, retain) UIViewController<RNNLayoutProtocol> *child;
  6. @end
  7. @implementation RNNSideMenuChildVC
  8. - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo creator:(id<RNNComponentViewCreator>)creator options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNBasePresenter *)presenter eventEmitter:(RNNEventEmitter *)eventEmitter childViewController:(UIViewController *)childViewController type:(RNNSideMenuChildType)type {
  9. self = [super initWithLayoutInfo:layoutInfo creator:creator options:options defaultOptions:defaultOptions presenter:presenter eventEmitter:eventEmitter childViewControllers:nil];
  10. self.type = type;
  11. self.child = childViewController;
  12. return self;
  13. }
  14. - (void)renderTreeAndWait:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
  15. [self.getCurrentChild renderTreeAndWait:wait perform:readyBlock];
  16. }
  17. - (void)setChild:(UIViewController<RNNLayoutProtocol> *)child {
  18. _child = child;
  19. [self addChildViewController:self.child];
  20. [self.child.view setFrame:self.view.bounds];
  21. [self.view addSubview:self.child.view];
  22. [self.view bringSubviewToFront:self.child.view];
  23. }
  24. - (void)setWidth:(CGFloat)width {
  25. CGRect frame = self.child.view.frame;
  26. frame.size.width = width;
  27. self.child.view.frame = frame;
  28. }
  29. - (UIViewController *)getCurrentChild {
  30. return self.child;
  31. }
  32. - (UIStatusBarStyle)preferredStatusBarStyle {
  33. return [[self presenter] getStatusBarStyle:[self resolveOptions]];
  34. }
  35. @end