AI have a slider, I’m saving it’s value to user defaults, and then grabbing that number in a different view. I’m then converting that float to an NSNumber for use in a CiRadialGradient filter.
I’m saving the value like:
[[NSUserDefaults standardUserDefaults] setFloat:_alphaSlider.value forKey:@"Alpha"];
And retrieving like:
NSNumber *inRadius1 = [NSNumber numberWithFloat:[[NSUserDefaults standardUserDefaults] floatForKey:@"Alpha"]];
The problem is when grabbing the slider value and converting it to an NSNumber, I get the value of -1.10311e-146. I’d expect something different.
In my storyboard the slider value is set from 0 to 100. No matter where I place the slider, the value is always a large negative.
Any ideas?
Cheers.
I’d guess you’re logging it like this:
But actually an NSNumber is an Objective-C object, so you should use
%@: