react-native-navigation的迁移库

RNNSplitViewOptions.m 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #import "RNNSplitViewOptions.h"
  2. #import "RNNRootViewProtocol.h"
  3. @implementation RNNSplitViewOptions
  4. -(void)applyOn:(UIViewController<RNNRootViewProtocol> *)viewController {
  5. UISplitViewController *svc = (UISplitViewController*) viewController;
  6. if (@available(iOS 11.0, *)) {
  7. if ([self.primaryEdge isEqualToString:@"trailing"]) {
  8. [svc setPrimaryEdge:UISplitViewControllerPrimaryEdgeTrailing];
  9. } else {
  10. [svc setPrimaryEdge:UISplitViewControllerPrimaryEdgeLeading];
  11. }
  12. }
  13. if ([self.displayMode isEqualToString:@"visible"]) {
  14. [svc setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];
  15. } else if ([self.displayMode isEqualToString:@"hidden"]) {
  16. [svc setPreferredDisplayMode:UISplitViewControllerDisplayModePrimaryHidden];
  17. } else if ([self.displayMode isEqualToString:@"overlay"]) {
  18. [svc setPreferredDisplayMode:UISplitViewControllerDisplayModePrimaryOverlay];
  19. } else {
  20. [svc setPreferredDisplayMode:UISplitViewControllerDisplayModeAutomatic];
  21. }
  22. if (self.minWidth) {
  23. [svc setMinimumPrimaryColumnWidth:[self.minWidth doubleValue]];
  24. }
  25. if (self.maxWidth) {
  26. [svc setMaximumPrimaryColumnWidth:[self.maxWidth doubleValue]];
  27. }
  28. }
  29. @end