react-native-navigation的迁移库

RNNSideMenuChildVC.m 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # pragma mark - UIViewController overrides
  33. - (void)willMoveToParentViewController:(UIViewController *)parent {
  34. [self.presenter willMoveToParentViewController:parent];
  35. }
  36. - (UIStatusBarStyle)preferredStatusBarStyle {
  37. return [self.presenter getStatusBarStyle];
  38. }
  39. - (BOOL)prefersStatusBarHidden {
  40. return [self.presenter getStatusBarVisibility];
  41. }
  42. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  43. return [self.presenter getOrientation];
  44. }
  45. - (BOOL)hidesBottomBarWhenPushed {
  46. return [self.presenter hidesBottomBarWhenPushed];
  47. }
  48. @end