react-native-navigation的迁移库

RNNSideMenuController.m 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // RNNSideMenuController.m
  3. // ReactNativeNavigation
  4. //
  5. // Created by Ran Greenberg on 09/02/2017.
  6. // Copyright © 2017 Wix. All rights reserved.
  7. //
  8. #import "RNNSideMenuController.h"
  9. #import "RNNSideMenuCenterVC.h"
  10. @interface RNNSideMenuController ()
  11. @property (readwrite) RNNSideMenuCenterVC *center;
  12. @property (readwrite) RNNSideMenuLeftVC *left;
  13. @property (readwrite) RNNSideMenuRightVC *right;
  14. @end
  15. @implementation RNNSideMenuController
  16. -(instancetype)initWithControllers:(NSArray*)controllers;
  17. {
  18. self = [super init];
  19. [self setControllers:controllers];
  20. return self;
  21. }
  22. -(void)setControllers:(NSArray*)controllers {
  23. for (id controller in controllers) {
  24. if ([controller isKindOfClass:[RNNSideMenuCenterVC class]]) {
  25. self.center = controller;
  26. }
  27. else if ([controller isKindOfClass:[RNNSideMenuLeftVC class]]){
  28. self.left = controller;
  29. }
  30. else if ([controller isKindOfClass:[RNNSideMenuRightVC class]]) {
  31. self.right = controller;
  32. }
  33. else {
  34. @throw [NSException exceptionWithName:@"UnknownSideMenuControllerType" reason:[@"Unknown side menu type " stringByAppendingString:[controller description]] userInfo:nil];
  35. }
  36. }
  37. }
  38. @end