react-native-navigation的迁移库

RNNSideMenuChildVC.m 1.5KB

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)render {
  15. [self addChildViewController:self.child];
  16. [self.child.view setFrame:self.view.bounds];
  17. [self.view addSubview:self.child.view];
  18. [self.view bringSubviewToFront:self.child.view];
  19. [self.child render];
  20. }
  21. - (void)setChild:(UIViewController<RNNLayoutProtocol> *)child {
  22. _child = child;
  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