hello i have a UIimageView with a PNG image that has round corners, image sits fine the only problem it has is that i can see the UIImage Corners with a white background, how can I make the background clear and transparent.
Try this:
imageView.backgroundColor = [UIColor clearColor];
imageView.opaque = NO;
You can achieve the same thing in IB by making the 'Background' a color with 0% opacity, and unticking the 'Opaque' checkbox.
try
imageView.backgroundColor = [UIColor clearColor];
Related
Is there a way such that I can set the alpha of a UILabel, but it doesn't fade out the text of the UILabel? Meaning just the background?
As the text is a part of the label, if you set the alpha for the label the text fades appropriately. What you want is to set a backgroundColor with the appropriate alpha:
myLabel.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:0.5];
You may have to create a background view (UIView will suffice), and put the UILabel on top (not as a subview, because the alpha value of the background view affects all of its subviews)
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.
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];
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.
I want to set my UItextview s color transparent but not completely transparent. I want little bit gray or black at the background exactly like the picture
I am using this code right now
_textView.backgroundColor = [UIColor clearColor];
how can I make it transparent like in the picture above? Any example Code?
You should use something like this:
_textView.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5];
where alpha - parameter for transparent ( 50% in example).
Does this do what you want? (You may need to experiment with the values).
_textView.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5];
u build an UIView and put an image as the view backgrond:
self.tmpView = [[UIView alloc] initWithFrame:CGRectMake(20, 70, 280, 295)];
self.tmpView.backgroundColor = [UIColor yellowColor];
self.tmpView.backgroundColor = [UIColor clearColor];
self.tmpView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"CloseUPPicBG.png"]];
the problem is that theuiview is now with corners in black color.
the image that i put as backgrond is with rounded corners.
any solution for this?
Edit the image to not have rounded corners, or so that the space behind the corners is some other color or image.
What you're doing is saying
View, be yellow.
View, be clear. What's behind you? Nothing. Ok, be black.
View, fill yourself with this image.
View is then thinking
Hmm... there's transparency in this image.
Guess I should show whatever's behind me. Which is nothing... So black.
self.tmpView.opaque = NO;
might help.
can I change the background image of my TTThumbsViewController. It's the thumbnail overview screen and at the moment it is white. Can I turn it to transparent?
Thx :-)
(void)viewDidLoad {
self.tableView.backgroundColor = [UIColor blackColor];
}