I have a ViewController where I set up values for main page which is a different view. These settings are saved into an NSDictionary and then to a plist. One of these settings is a UIStepper and on the main ViewController this value controls the alpha setting on a UIImageView.
A stepper value returns a double. The range of an alpha for a UIImageView is 0.0 to 1.0 so I need to convert.
I save the code from my VC1 to the NSDict and to plist.
Then in VC2 after I read in the plist to an NSDict
If I set the stepper to a value of 6. The final float value is 6.0 when I need 0.6. I am at a loss as to how to best convert this to have a value from 0.0 to 1.0? I thought well I'll just flip the numbers to so 6.0 would be 0.6 but that won't work for 1.0 alpha value.
Can some one push me in the right direction to convert this?
Thanks.
A stepper value returns a double. The range of an alpha for a UIImageView is 0.0 to 1.0 so I need to convert.
I save the code from my VC1 to the NSDict and to plist.
Code:
mainImageAlpha = [NSString stringWithFormat:@"%f",[[NSNumber numberWithDouble:[(UIStepper *) sender value]]floatValue]];
Then in VC2 after I read in the plist to an NSDict
Code:
backGroundWhiteWash.alpha = [[characterLoadInfo objectForKey:@"mainImageAlpha"]floatValue];
If I set the stepper to a value of 6. The final float value is 6.0 when I need 0.6. I am at a loss as to how to best convert this to have a value from 0.0 to 1.0? I thought well I'll just flip the numbers to so 6.0 would be 0.6 but that won't work for 1.0 alpha value.
Can some one push me in the right direction to convert this?
Thanks.