I have an BackGroundImage
which is "image1.png
" and another image "image2.png
". I have a UIslider
... When i move the slider the background image has to diappear .. How to implement it?
-
what you want? your background image changed with slider value?? – Paras Joshi Nov 19 '12 at 09:35
2 Answers
Set the alpha to 0, for hiding the imageView, and setting the dissappear effect. The maximum value of Alpha is 1 and minimum is 0. If you set the Maximum value of your slider as 1 and minimum value of your slider as 0, you can use the following method for your purpose. This method is need to be set as the action of slider's value change.
- (void)sliderChange:(UISlider *)sender
{
yourImageView.alpha = sender.value;
}

- 103,496
- 31
- 153
- 200
CGImageCreateWithMask takes two parameters original image and imageMask and it returns masked image. We wrap masked image in UIImage object and release masked image reference. If we want to paint unpainted area in our output/masked image then we can draw our masked image in a bitmap context which is filled with background color.
for more detail see this link may you can get some Idea from this tutorial.
Understanding-image-Reflection-masking
after that when you want to setAlpha
to the BackgroundImage then set with this bellow. line..
yourMaskingImage.alpha = yourSLider.value;

- 20,427
- 11
- 57
- 70