In the following image, there is a transparent image, but the thing is that I have to remove the black screen, but not I remove this black screen , I set the layer opacity to zero, but not get the output.???
HOw Can I remove that black image;
We need to know how you create that image.
If you are using and UIImageView set the background color to transparent.
If it is a UIView instance set background color to clear color like this
[view setBackgroundColor:[UIColor clearColor]];
Related
Our designer created some picture and the application has a UIToolbar at the top of the screen. I captured the RGB values of the bar's color, but when I set the tint color in the code based on these values I got different color than on the picture can be seen.
How can I set exactly the same tint color that I can see on the picture?
Thanks,
madik
Use setTintcolor: to set the color
To get pattern color from image
use colorWithPatternImage:
[toolbar setTintColor: [UIColor colorWithPatternImage:[UIImage imageNamed:#"Myimagename"]];
I want to use custom graphics as UINavigationBar background:
[[UINavigationBar appearance]
setBackgroundImage:[UIImage imageNamed:#"tile"]
forBarMetrics:UIBarMetricsDefault];
Works fine, except I lost default gradient, white line at top and black line at bottom of the titlebar. Any ideas how to get them back?
Gave up and added gradient and lines into the texture. Of course this meant that I had to hardcode texture height as 44 pixels == navigation bar size for vertical orientation.
Not happy with the solution, but it does work without any problems.
I am using PNG images to add icons to the rows in my tableview, using
[cell.imageView setImage:[UIImage imageNamed:#"chart.png"]];
This was not a problem before, as my images had black edges and my tableview had black rows. However, I am now providing a light color style as well as dark. So the black edges look rough.
So I thought I would draw the images with a black background.
However, I don't know how to do this?
UIImageView inherits from UIView so you can just set the backgroundColor property to show a color behind the transparant parts of your png image
[cell.imageView setBackgroundColor:[UIColor blackColor]];
I have set up my own custom tableViewCell and want to the background to be the same
black gradient as my navigationBar with style UIBarStyleBlackOpaque.
what would be the best way to do that ?
Use the key combination CMD-SHIFT-4 to capture a 1 pixel wide image of the navigation bar's gradient. The image will be saved on your desktop (you can use Preview to crop, etc.). Add the image to your project. In -tableView:cellForRowAtIndexPath:, use:
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"blackGradient.png"]];
UIKit automatically stretches the gradient horizontally to fit the width of the cell.
I'm trying to have a modular uiview that will be placed on top of another view. The modular view has an alpha value of 0.5, and appears in the middle of the main view.
Now, I would like for text to be rendered on that modular UIView. However, whenever I:
[modularView addSubview:text]
it looks all hazy.
How can I make the text tack sharp, but keep the alpha of its parent view at 0.5?
Thanks!
Set the alpha for the background color rather than for the whole view:
[modularView setBackgroundColor:[UIColor colorWithRed:0.0
green:0.0
blue:0.0
alpha:0.5]];
This will allow any subviews to retain full opacity. The color in my code is black. Just set the RGB values for whatever color you're wanting.
You could also just use a UILabel instead of a UIView and set it's background the same way. Then you don't need to add a subview--though I'm not sure what else you have in your modularView view.
I'm doing the same on a project i'm working on, my "modalview" is on top of a fullscreen image.
My "modalview" has alpha 1.0 and the background color is black with 50% opacity.
Then the text is white, with default highlight and a dark shadow with 1.0 h and v-offset.
Hope it helps...
PS: make sure you're adding the text in front of the "modalview", not behind it ;)