react-native-navigation的迁移库

RNNSplitViewControllerPresenter.m 1.9KB

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