I have a NSSlider that is attempting to convert a regular float into a CGFloat. The code that I am using:
CGFloat testing = [mainSlider floatValue];
However this simply makes the testing variable "0.00" when I attempt to log it.
NSLog(@"%f", testing);
Does anyone have any ideas as to why this would happen? Thanks for any help.
try this just in case (can't remember if CGFloat is a double or not):
NSLog(@"%f", (double)testing);
Check that the variable isn't being shadowed like this:
CGFloat testing = 0.0;
if(YES){
CGFloat testing = [mainSlider floatValue];
//should be: testing = [mainSlider floatValue];
}
NSLog(@"testing = %f", testing); //this will print "testing = 0.000000"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With