react-native-navigation的迁移库

RNNSideMenuSideOptions.m 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #import "RNNSideMenuSideOptions.h"
  2. #import "RNNSideMenuController.h"
  3. @implementation RNNSideMenuSideOptions
  4. - (void)applyOnSide:(MMDrawerSide)side viewController:(UIViewController *)viewController {
  5. RNNSideMenuController* sideMenuController = (RNNSideMenuController*)UIApplication.sharedApplication.delegate.window.rootViewController;
  6. if (sideMenuController && [sideMenuController isKindOfClass:[RNNSideMenuController class]]) {
  7. if (self.enabled) {
  8. switch (side) {
  9. case MMDrawerSideRight:
  10. sideMenuController.sideMenu.rightSideEnabled = [self.enabled boolValue];
  11. break;
  12. case MMDrawerSideLeft:
  13. sideMenuController.sideMenu.leftSideEnabled = [self.enabled boolValue];
  14. default:
  15. break;
  16. }
  17. }
  18. if (self.visible) {
  19. if (self.visible.boolValue) {
  20. [sideMenuController showSideMenu:side animated:YES];
  21. } else {
  22. [sideMenuController hideSideMenu:side animated:YES];
  23. }
  24. }
  25. if (self.width) {
  26. switch (side) {
  27. case MMDrawerSideRight:
  28. sideMenuController.sideMenu.maximumRightDrawerWidth = self.width.floatValue;
  29. break;
  30. case MMDrawerSideLeft:
  31. sideMenuController.sideMenu.maximumLeftDrawerWidth = self.width.floatValue;
  32. default:
  33. break;
  34. }
  35. }
  36. }
  37. [self resetOptions];
  38. }
  39. - (void)resetOptions {
  40. self.visible = nil;
  41. self.enabled = nil;
  42. }
  43. @end