浏览代码

VLCSettingsController: Observe kVLCThemeDidChangeNotification

Soomin Lee 5 年之前
父节点
当前提交
08d6ba39f1
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Sources/VLCSettingsController.m

+ 5 - 1
Sources/VLCSettingsController.m

@@ -76,6 +76,11 @@ NSString * const kVLCSectionTableHeaderViewIdentifier = @"VLCSectionTableHeaderV
     actionSheet.modalPresentationStyle = UIModalPresentationCustom;
     
     specifierManager = [[VLCSettingsSpecifierManager alloc] initWithSettingsReader:self.settingsReader settingsStore:self.settingsStore];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(themeDidChange)
+                                                 name:kVLCThemeDidChangeNotification
+                                               object:nil];
 }
 
 - (void)themeDidChange
@@ -142,7 +147,6 @@ NSString * const kVLCSectionTableHeaderViewIdentifier = @"VLCSectionTableHeaderV
     if ([notification.object isEqual:kVLCSettingAppTheme]) {
         BOOL darkTheme = [[notification.userInfo objectForKey:kVLCSettingAppTheme] boolValue];
         PresentationTheme.current = darkTheme ? PresentationTheme.darkTheme : PresentationTheme.brightTheme;
-        [self themeDidChange];
     }
 }