react-native-navigation的迁移库

RNNSplitViewControllerPresenter.m 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #import "RNNSplitViewControllerPresenter.h"
  2. #import "UISplitViewController+RNNOptions.h"
  3. #import "RNNSplitViewController.h"
  4. @implementation RNNSplitViewControllerPresenter
  5. -(instancetype)initWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
  6. self = [super initWithDefaultOptions:defaultOptions];
  7. return self;
  8. }
  9. - (void)applyOptions:(RNNNavigationOptions *)options {
  10. [super applyOptions:options];
  11. UISplitViewController* splitViewController = self.boundViewController;
  12. [splitViewController rnn_setDisplayMode:options.splitView.displayMode];
  13. [splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
  14. [splitViewController rnn_setMinWidth:options.splitView.minWidth];
  15. [splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
  16. }
  17. - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
  18. [super applyOptionsOnInit:initialOptions];
  19. UISplitViewController* splitViewController = self.boundViewController;
  20. [splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
  21. [splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
  22. [splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
  23. [splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
  24. }
  25. - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
  26. [super mergeOptions:options resolvedOptions:currentOptions];
  27. UISplitViewController* splitViewController = self.boundViewController;
  28. if (options.splitView.displayMode) {
  29. [splitViewController rnn_setDisplayMode:options.splitView.displayMode];
  30. }
  31. if (options.splitView.primaryEdge) {
  32. [splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
  33. }
  34. if (options.splitView.minWidth) {
  35. [splitViewController rnn_setMinWidth:options.splitView.minWidth];
  36. }
  37. if (options.splitView.maxWidth) {
  38. [splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
  39. }
  40. }
  41. @end