ios7 toolbar color washed out - ios7

In iOS 7, if I set the toolbar background color, it uses a washed out version of the color, not the actual color. At first I thought maybe the toolbar was semi-transparent (not fully opaque) but that doesn't appear to be the problem.
Even using black only give me a light grey color.
[topToolbar setBackgroundColor:[UIColor blackColor]];
I also tried:
[topToolbar setTranslucent:NO];
But that just caused my toolbar color to be ignored completely.
Anybody know how to make it just use the color specified, without any weirdness?
Thanks.

I wasn't aware of the setBarTintColor method previously, but it is what is needed to accomplish this.
[topToolbar setBarTintColor:[UIColor blackColor]];
[topToolbar setTranslucent:NO];

Related

creating color themes in objective-c

I am making a simple calculator. However, I want the color theme to change every time the program is loaded (the theme doesn't change while the program is running). I have an array that stores UIColors that I'm using to change the background color, and that works fine. What I want is to also change the colors of the buttons and labels to match the theme. So when a red background is chosen (at random), all the buttons, text and labels have a red color theme. The next time the program is loaded, it has a yellow color theme; and so on and so forth. What would be the best way to do this?
Use the UIAppearance protocol to get an appearance proxy for each class that you want to customize, and call the appropriate methods to make your changes. For example:
[[UINavigationBar appearance] setTintColor:[UIColor redColor]];
[[UIButton appearance] setTintColor:[UIColor redColor]];
See this NSCookbook recipe and read the NSHipster article for more detailed examples.

UISegmentedControl Buggy Tint Color in IOS 7.1

When setting the tint color of a UISegmentedControl using the Appearance API, the color of the text in each unselected segment takes the color of the UILabel instead only after switching tabs.
A sample program to test this (screenshots below):
Load the program and look at the first tab. Everything is normal, the labels are red and the segments are blue.
Switch away to the second tab, everything is still fine.
Switch back to the first tab, you will see that the segments have changed to be red instead of blue like they should.
App was just loaded, everything is fine:
After switching tabs, color is wrong:
Code responsible (in the app delegate for testing, but happens elsewhere):
[[UILabel appearance] setTextColor:[UIColor redColor]];
[[UISegmentedControl appearance] setTintColor:[UIColor blueColor]];
I have sent this information to Apple in a bug report. They asked for a sample project, but I haven't gotten an answer yet. This only shows up on IOS 7.1. On 7.0, this doesn't happen.
Are there any suggestions or temporary fixes that would resolve this? It makes my app look bad even though I don't think it's my fault (the red is just to test, that would make anybody's app look bad). I have tried setting controls manually by setting the tint of the specific control instead of using the appearance API, but the problem is still there.
As discussed in the comments, use [[UILabel appearanceWhenContainedIn:[UISegmentedControl class], nil] setTextColor:[UIColor blueColor]]; to set the appearance of the internal label contained in a segment control.
Per the Apple documentation: Setting the tintColor property by using the appearance proxy APIs is not supported in iOS 7.
iOS 7 UI Transition Guide
You can also specify text attributes like of UISegmentedControl like font, using setTitleTextAttributes:forState.

weird UITabBar color inconsistency in iOS7

I'm using iOS 7's tintColor and barTintColor properties to color my UITabBar with this code in a subclass of UITabBarController:
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:123/255.0 green:47/255.0 blue:85/255.0 alpha:1]];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:227/255.0 green:180/255.0 blue:204/255.0 alpha:1]];
On three screens, the color is what I want it to be (only two images illustrating this):
One one screen, the color is weirdly lighter. This screen is a UIWebView.
Then on a fourth screen, the color is SUPER-light. This screen is the only one to use a storyboard--the rest are all done programmatically.
What am I doing wrong? Do the fact that the misbehaving screens are a UIWebView and a storyboard have anything to do with why they're misbehaving? And how do I fix them? I've fiddled with the alpha of the bar but it doesn't change anything.
Thanks for your help.
You're seeing tab bar translucency...i.e. the background view is bleeding through and being blurred. If you want to disable this, you can do:
[tabBar setTranslucent:NO]
on your tab-bar.
On your top two images, its not clear to me if the underlying view controller view is edge-to-edge, i.e. your top two images should look like the fourth one since both have pink backgrounds. Anyhow, setTranslucent:NO should make them all look like the top image.
You can also uncheck "Translucent" at the Attributes Inspector:

How to hide NSTableView's white outline on a black window?

So what I've been trying to do was to put a NSTableView on a black background. However, for some kind of reason there's this white outline that wraps the NSTableView like this:
What I've got here is a translucent window with a subclassed NSTableView so that I can customize it's color. Alternating rows are turned on.
I've tried setting the grid color and background to a color with 0 alpha value, however nothing changes. Does anyone know why or how I can fix this? Thanks!
I think in Your NSTableView horizontal grid is turned on. You can turn off it in Attributes inspector and change colors also (grid and background).
Have you tried this:
tableView.backgroundColor = [UIColor clearColor];
tableView.separatorColor = [UIColor grayColor];
Your screenshot link is broken, so it’s hard to tell what you’re looking for exactly.
This answer might interest you, though: https://stackoverflow.com/a/4349459/135712
[yourTableView setIntercellSpacing:NSMakeSize(0.0, 0.0)];

Embossed text in UILabel

I need to draw an effect like this on a UILabel.
How can I do it?
U can try the below code. U can change the color of the text or the shadow based on the color of the background.
[label setShadowColor:[UIColor darkGrayColor]];
[label setShadowOffset:CGSizeMake(0, -1)];
If you're on gray background, I usually just use UILabel's text shadow property positioned one pixel below with color white. That comes quite close. If you really need more (i.e. if you want to have the dark edges above, then you need to write a custom label that draws the text multiple times). CoreGraphics can help you a bit with the CGContextSetShadow, though.