Here is the code for my 3 CCSliders, they change the bat color fine, I saved the sliders and those are working fine, but I need to save the _SettingBat.color to load across the app, this is where I am having issues saving the color to NSUserDefaults.
CCColor *batColor;
-(void)redSlider
{
batColor = [CCColor colorWithRed:_redSlider.sliderValue green:_greenSlider.sliderValue blue:_blueSlider.sliderValue];
_settingsBat.color = batColor;
}
-(void)greenSlider
{
batColor = [CCColor colorWithRed:_redSlider.sliderValue green:_greenSlider.sliderValue blue:_blueSlider.sliderValue];
_settingsBat.color = batColor;
}
-(void)blueSlider
{
batColor = [CCColor colorWithRed:_redSlider.sliderValue green:_greenSlider.sliderValue blue:_blueSlider.sliderValue];
_settingsBat.color = batColor;
}
-(void)save
{
NSLog(@"The Color is, %@",_settingsBat.color);
[[NSUserDefaults standardUserDefaults] setFloat:_redSlider.sliderValue forKey:@"redSlider"];
[[NSUserDefaults standardUserDefaults] setFloat:_greenSlider.sliderValue forKey:@"greenSlider"];
[[NSUserDefaults standardUserDefaults] setFloat:_blueSlider.sliderValue forKey:@"blueSlider"];
[[NSUserDefaults standardUserDefaults]synchronize];
_savedLabel.visible = TRUE;
NSLog(@"My Key is, %@",[[NSUserDefaults standardUserDefaults] stringForKey:@"batColor"]);
}