react-native-navigation的迁移库

UISplitViewController+RNNOptions.m 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #import "UISplitViewController+RNNOptions.h"
  2. #import "RNNSplitViewController.h"
  3. @implementation UISplitViewController (RNNOptions)
  4. - (void)rnn_setDisplayMode:(NSString *)displayMode {
  5. if ([displayMode isEqualToString:@"visible"]) {
  6. self.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
  7. } else if ([displayMode isEqualToString:@"hidden"]) {
  8. self.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryHidden;
  9. } else if ([displayMode isEqualToString:@"overlay"]) {
  10. self.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryOverlay;
  11. } else {
  12. self.preferredDisplayMode = UISplitViewControllerDisplayModeAutomatic;
  13. }
  14. }
  15. - (void)rnn_setPrimaryEdge:(NSString *)primaryEdge {
  16. if (@available(iOS 11.0, *)) {
  17. if ([primaryEdge isEqualToString:@"trailing"]) {
  18. self.primaryEdge = UISplitViewControllerPrimaryEdgeTrailing;
  19. } else {
  20. self.primaryEdge = UISplitViewControllerPrimaryEdgeLeading;
  21. }
  22. }
  23. }
  24. - (void)rnn_setMinWidth:(Number *)minWidth {
  25. if (minWidth.hasValue) {
  26. [self setMinimumPrimaryColumnWidth:[[minWidth get] doubleValue]];
  27. }
  28. }
  29. - (void)rnn_setMaxWidth:(Number *)maxWidth {
  30. if (maxWidth.hasValue) {
  31. [self setMaximumPrimaryColumnWidth:[[maxWidth get] doubleValue]];
  32. }
  33. }
  34. @end