HWBackgroundConfig.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // HWBackgroundConfig.m
  3. // Pods
  4. //
  5. // Created by heath wang on 2020/4/17.
  6. //
  7. #import "HWBackgroundConfig.h"
  8. @implementation HWBackgroundConfig
  9. - (instancetype)init {
  10. self = [super init];
  11. if (self) {
  12. self.backgroundBehavior = HWBackgroundBehaviorDefault;
  13. }
  14. return self;
  15. }
  16. - (instancetype)initWithBehavior:(HWBackgroundBehavior)backgroundBehavior {
  17. self = [super init];
  18. if (self) {
  19. self.backgroundBehavior = backgroundBehavior;
  20. }
  21. return self;
  22. }
  23. + (instancetype)configWithBehavior:(HWBackgroundBehavior)backgroundBehavior {
  24. return [[self alloc] initWithBehavior:backgroundBehavior];
  25. }
  26. #pragma mark - Setter
  27. - (void)setBackgroundBehavior:(HWBackgroundBehavior)backgroundBehavior {
  28. _backgroundBehavior = backgroundBehavior;
  29. switch (backgroundBehavior) {
  30. case HWBackgroundBehaviorSystemVisualEffect: {
  31. self.visualEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
  32. }
  33. break;
  34. case HWBackgroundBehaviorCustomBlurEffect: {
  35. self.backgroundBlurRadius = 10;
  36. self.blurTintColor = [UIColor whiteColor];
  37. }
  38. break;
  39. default: {
  40. self.backgroundAlpha = 0.7;
  41. }
  42. break;
  43. }
  44. }
  45. @end