react-native-navigation的迁移库

RNNStatusBarOptions.m 994B

1234567891011121314151617181920212223242526272829303132333435
  1. #import "RNNStatusBarOptions.h"
  2. #define kStatusBarAnimationDuration 0.35
  3. @implementation RNNStatusBarOptions
  4. - (void)applyOn:(UIViewController *)viewController {
  5. if (self.blur) {
  6. UIView* curBlurView = [viewController.view viewWithTag:BLUR_STATUS_TAG];
  7. if ([self.blur boolValue]) {
  8. if (!curBlurView) {
  9. UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
  10. blur.frame = [[UIApplication sharedApplication] statusBarFrame];
  11. blur.tag = BLUR_STATUS_TAG;
  12. [viewController.view insertSubview:blur atIndex:0];
  13. }
  14. } else {
  15. if (curBlurView) {
  16. [curBlurView removeFromSuperview];
  17. }
  18. }
  19. }
  20. if (self.style || self.hidden) {
  21. [UIView animateWithDuration:[self statusBarAnimationDuration] animations:^{
  22. [viewController setNeedsStatusBarAppearanceUpdate];
  23. }];
  24. }
  25. }
  26. - (CGFloat)statusBarAnimationDuration {
  27. return [self.animate boolValue] ? kStatusBarAnimationDuration : CGFLOAT_MIN;
  28. }
  29. @end