react-native-navigation的迁移库

RNNSplitViewControllerPresenter.m 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #import "RNNSplitViewControllerPresenter.h"
  2. #import "UISplitViewController+RNNOptions.h"
  3. #import "RCTConvert+Modal.h"
  4. #import "RNNSplitViewController.h"
  5. @implementation RNNSplitViewControllerPresenter
  6. - (void)bindViewController:(UISplitViewController *)bindedViewController viewCreator:(id<RNNRootViewCreator>)creator {
  7. self.bindedViewController = bindedViewController;
  8. }
  9. - (void)applyOptions:(RNNNavigationOptions *)options {
  10. [super applyOptions:options];
  11. UISplitViewController* splitViewController = self.bindedViewController;
  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.bindedViewController;
  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 *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
  26. [super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
  27. UISplitViewController* splitViewController = self.bindedViewController;
  28. if (newOptions.splitView.displayMode) {
  29. [splitViewController rnn_setDisplayMode:newOptions.splitView.displayMode];
  30. }
  31. if (newOptions.splitView.primaryEdge) {
  32. [splitViewController rnn_setPrimaryEdge:newOptions.splitView.primaryEdge];
  33. }
  34. if (newOptions.splitView.minWidth) {
  35. [splitViewController rnn_setMinWidth:newOptions.splitView.minWidth];
  36. }
  37. if (newOptions.splitView.maxWidth) {
  38. [splitViewController rnn_setMaxWidth:newOptions.splitView.maxWidth];
  39. }
  40. }
  41. @end