Question

I am creating an iOS application in which I have added a simple UIImage. I want to add the transparency effect in image to show other images behind that main image. Tell me how I can achieve this effect?

Note: I don't want to change the opacity/alpha of image.

Was it helpful?

Solution

An alpha change is how you alter transparency. In addition to this, you would want to alter this on the view level not on to the UIImage directly. E.x:

[myImageView setImage:[UIImage imageNamed@"myImage.png"]];
[myImageView setAlpha:0.7f];

OTHER TIPS

use images in png format with alpha channel in it: alpha channel is the layer that tells how many transparent each pixel is

how about this:

self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f,0.0f,1024.0f,768.0f)];
self.imageView.backgroundColor = [UIColor colorWithRed:255 green:255 blue:255 alpha:0.5];
[self.view addSubview:self.imageView];

or set its alpha
imageView.alpha = 0.5;

But be sure to instantiate the imageView, as property then synthesize.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top