GHThemeManager.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // GHThemeManager.m
  3. // GameHelper
  4. //
  5. // Created by 青秀斌 on 16/12/29.
  6. // Copyright © 2016年 kylincc. All rights reserved.
  7. //
  8. #import "GHThemeManager.h"
  9. #define USERINFO_THEME_TYPE @"USERINFO_THEME_TYPE"
  10. @interface GHThemeManager ()
  11. @property (nonatomic, assign) ThemeType themeType;
  12. @end
  13. @implementation GHThemeManager
  14. - (instancetype)init {
  15. if (self = [super init]) {
  16. NSUserDefaults *userInfo = [NSUserDefaults standardUserDefaults];
  17. NSNumber *themeType = [userInfo objectForKey:USERINFO_THEME_TYPE];
  18. switch (themeType.integerValue) {
  19. case ThemeType_Night:{
  20. self.themeType = ThemeType_Night;
  21. }break;
  22. default:{
  23. self.themeType = ThemeType_Defalt;
  24. }break;
  25. }
  26. }
  27. return self;
  28. }
  29. /**********************************************************************/
  30. #pragma mark - Public
  31. /**********************************************************************/
  32. - (void)switchToTheme:(ThemeType)themeType {
  33. self.themeType = themeType;
  34. // [GHAppEngine loadColorConfigDic];
  35. [[NSNotificationCenter defaultCenter] postNotificationName:GHThemeChangeNotification object:self];
  36. }
  37. @end