In my app, I'm using UISlider to reduce/improve the brightness of a UIImage. My slider's min value=0 and max value=1.Slider's current value is 1; When I move the slider from 1 to 0.7 my UIImage is getting bright but when I move from that 0.7 to 1, UIImage isn't reducing the brightness; Here is the code for my UISlider's Action:
-(IBAction)sliderBright:(UISlider*)sender
{
float alphavalue;
value2 = sender.value;
if (value1>=value2) {//I fixed value1=1.0 in Viewdidload();
NSLog(@"The value of the slider and Alpha is %f,", value2);
alphavalue= value2;
value2=value1;
}
else{
alphavalue= value2+0.2;
value2=value1;
}
_displayImage.alpha=alphavalue;
}
How can I fix it?Alpha value for a UIImage control the whiteness, similarly is there any way to control the blackness of UIImage?