Ios 在调整中使用HBPreferences
我们什么时候用这个?它注册了一个变量!我们可以使用iPhonedevwiki中给出的古老而简单的方法来实现这一点,并添加一个观察者来观察偏好的变化。但我看到一些调整使用了HBPreferences,而不是iPhonedevwiki中给出的方法。有人能告诉我它是如何工作的吗?它比iPhonedevwiki中给出的方法好吗?谢谢 你可以这样使用它Ios 在调整中使用HBPreferences,ios,objective-c,jailbreak,theos,Ios,Objective C,Jailbreak,Theos,我们什么时候用这个?它注册了一个变量!我们可以使用iPhonedevwiki中给出的古老而简单的方法来实现这一点,并添加一个观察者来观察偏好的变化。但我看到一些调整使用了HBPreferences,而不是iPhonedevwiki中给出的方法。有人能告诉我它是如何工作的吗?它比iPhonedevwiki中给出的方法好吗?谢谢 你可以这样使用它 static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia"; static N
static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia";
static NSString *const kHBCBPreferencesEnabledKey = @"Enabled";
static NSString *const kHBCBPreferencesSwitchesKey = @"Switches";
static NSString *const kHBCBPreferencesSectionLabelKey = @"SectionLabel";
static NSString *const kHBCBPreferencesSwitchLabelsKey = @"SwitchLabels";
HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:kHBCBPreferencesDomain];
[preferences registerDefaults:@{
kHBCBPreferencesEnabledKey: @YES,
kHBCBPreferencesSwitchesKey: @[ /* ... */ ],
kHBCBPreferencesSectionLabelKey: @YES,
kHBCBPreferencesSwitchLabelsKey: @YES
}];
并添加观察者以进行更改
void HBCBPreferencesChanged() {
//Will be called when changes occur
}
/* Call this function to register an observer */
void addObserver(){
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)HBCBPreferencesChanged, CFSTR("ws.hbang.cobalia/ReloadPrefs"), NULL, kNilOptions);
}
您可以阅读更多关于它的信息,或者像这样使用它
static NSString *const kHBCBPreferencesDomain = @"ws.hbang.cobalia";
static NSString *const kHBCBPreferencesEnabledKey = @"Enabled";
static NSString *const kHBCBPreferencesSwitchesKey = @"Switches";
static NSString *const kHBCBPreferencesSectionLabelKey = @"SectionLabel";
static NSString *const kHBCBPreferencesSwitchLabelsKey = @"SwitchLabels";
HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:kHBCBPreferencesDomain];
[preferences registerDefaults:@{
kHBCBPreferencesEnabledKey: @YES,
kHBCBPreferencesSwitchesKey: @[ /* ... */ ],
kHBCBPreferencesSectionLabelKey: @YES,
kHBCBPreferencesSwitchLabelsKey: @YES
}];
并添加观察者以进行更改
void HBCBPreferencesChanged() {
//Will be called when changes occur
}
/* Call this function to register an observer */
void addObserver(){
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)HBCBPreferencesChanged, CFSTR("ws.hbang.cobalia/ReloadPrefs"), NULL, kNilOptions);
}
您可以阅读更多关于它的信息,或者您是否可以添加更多信息,例如指向iphonedevwiki文章的链接?@vrwim@vrwim不幸的是,我所说的不在iphonedevwiki上。您是否可以添加更多信息,比如一个关于iphonedevwiki的文章的链接?@vrwim@vrwim不幸的是,我所说的不在iphonedevwiki上。