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. [self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
  12. [self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
  13. [self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
  14. [self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
  15. }
  16. - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
  17. [super applyOptionsOnInit:initialOptions];
  18. [self.splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
  19. [self.splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
  20. [self.splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
  21. [self.splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
  22. }
  23. - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
  24. [super mergeOptions:options resolvedOptions:currentOptions];
  25. if (options.splitView.displayMode) {
  26. [self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
  27. }
  28. if (options.splitView.primaryEdge) {
  29. [self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
  30. }
  31. if (options.splitView.minWidth) {
  32. [self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
  33. }
  34. if (options.splitView.maxWidth) {
  35. [self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
  36. }
  37. }
  38. - (UISplitViewController *)splitViewController {
  39. return self.boundViewController;
  40. }
  41. @end