Search code examples
iosiphonexcodecocoa-touchinappsettingskit

Display Selected Value For Slider InAppSettings Kit


I am using InAppSettingsKit and I have a slider. I want to display the closest integer in the heading on the row above. I am not really concerned about the settings from the iphone settings but the one from within my app

AnnAppSettingsKit Slider

Here is my Root.InApp.Plist

Root.InApp.Plist

What I have done is define a notification which works when the slider is moved

#pragma mark kIASKAppSettingChanged notification
- (void)settingDidChange:(NSNotification*)notification {
if ([notification.object isEqual:kGameReward]) {
    }
}

I just do not know how to find and access the cell in the tableview to change it.


Solution

  • Just change the value for the answers key:

    NSInteger value = round([notification.userInfo[@"gamereward"] doubleValue]);
    [[NSUserDefaults standardUserDefaults] setInteger:value forKey:@"answers"]
    

    IASK automatically updates the UI when the underlying userDefaults are updated.