iPhone not displaying accurate color - ios

I'm working on a simple WebView app where I want the Statusbar to be the same color as the Taskbar from the website.
What I did was setting the background color of the View to the same color as the Taskbarby using the color picker. However when I run the app I'm getting a completely different color as you can see below:
These are the settings for the view:
The color code of the Taskbar is: #242424
However the color code the statusbar gets is: #1b1b1b even though I've selected the #242424 color via the color picker.
Why does it seem to do this?

It has to do with the translucency of the bar, as explained in these answers.
You also have to consider that the view extends under the translucent bar, and the view's background color will slightly change the appearance of any translucent bars above it, because of the visual effect used by the bar.
You may want to not set a specific color for the status bar, and let it inherit the bar's color, to give the task bar and status bar a uniform appearance.

Xcode Colour picker not pick exact same colour. Try this macro(set your colour code)
#define CODE_1_COLOR [UIColor colorWithRed:(140.0f/255.0f) green:(132.0f/255.0f) blue:(124.0f/255.0f) alpha:1.0f]
Also take care about Translucent property in case of navigation bar
[[UINavigationBar appearance] setTranslucent:NO];

Related

How can I set the color of a custom back arrow image with UINavigationBarAppearance?

I have an iOS app that uses a custom back chevron for the back button in navigation bars with custom background colors and shadows and such. I'd like to set the color of that back indicator image to something besides the default blue. How do I do that with the new UINavigationBarAppearance APIs?
I have tried:
Setting the back indicator image to a template image of my shape - this works, but doesn't affect the color.
Setting titleTextAttributes on the normal variant of the buttonAppearance, specifying NSForegroundColorAttributeName
Setting titleTextAttributes on all variants of the backButtonAppearance, specifying NSForegroundColorAttributeName and NSBackgroundColorAttributeName
Setting tintColor on the navigation bar directly - this affects the back indicator during animation of a new navigation item, but at the end of the animation it goes back to blue.
The tintColor works for me. The attached screencast shows (using slow animations) that having set the tint color to black, it stays black, both pushing and popping:

Bar Tint on UIToolBar when translucent is false

I try to set the Bar Tint Color (in Interface Builder) on a UIToolbar that has translucent set to off. No matter the color I choose, the toolbar is always white in the emulator (it changes color in IB). I need to set translucent to true in order to have my UIToolbar with the right Bar Tint. From the Apple doc, I don't see anywhere mentioned that barTintColor is not working when translucent is set to false.
Thanks
Edit
It looks like this is an issue only in interface builder, setting Bar Tint Color in code is working, anyone can confirm?
from the docs
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIToolbar_Class/#//apple_ref/occ/instp/UIToolbar/translucent
If you set this property to NO on a toolbar with a translucent custom background image, the toolbar provides an opaque background for the image using black if the toolbar has UIBarStyleBlack style, white if the toolbar has UIBarStyleDefault, or the toolbar’s barTintColor if a custom value is defined.

Set Statusbar color to same as Nav Bar

I want the Status Bar of my app to have the exact same color as my Navigation Bar. The way I found to change the color of the Status Bar was just by creating a view in the size of the Status Bar and change the background color.
However even though I use the color picker from the Nav bar to set the color of the view I get 2 totally different colors as seen in the picture below.
I've tried mixing with the color picker, changing opacity etc, however I'm never able to hit the correct color. Any ideas on how I can get the exact same color for the status bar?
The color of the UIStatusBar is automatically set to match the color of the UINavigationBar when you set the value of self.navigationController.navigationBar.barTintColor. Is there a reason you need to set them separately?
You can do the following:
Create an UIImage containing only the color you want with a size of 64x1. You could render that image in code.
Set the image as a background image for the navigationBar. Something like:
navigationController.navigationBar.setBackgroundImage(image, for: .default)

Status bar color is different to UINavigationBar color

I have a custom UINavigationBar which I am using to remove the gradient of the navbar in iOS 6. Though the color of the status bar is equal to the color of the screen opposed to the color of the bar
Is there a way to make them the same color or at least make the status bar black. My problem is in ios7.
Also if I change the style of the UINavigationBar translucent to NO like this:
self.navigationController.navigationBar.translucent = NO;
Then the status bar goes completely black with no writing on it.
In your project info plist, change UIViewControllerBasedStatusBarAppearance value, if there is no, then add this key.

UITabBar not updating appearance after Load

I am having a problem with UITabBar, seems like the call to
[[UITabBar appearance] setSelectedImageTintColor:barColor];
does nothing once the tabbar is showing, if i put the line in the ViewDidLoad (ViewWillAppear) it does work.
Any hint?
in the Apple docs for UITabBar it says
"The tint color to apply to the gradient image used when creating the selected image."
Note the creating, meaning that it reads this property when initalising/creating the tab bar, but it can't be set after. If you wanted to dynamically you'd have to get a little bit fiddly and overlay a semi transparent UIView over the selected image to change the colour, but it's not really ideal... There is some examples of that type of thing here
Changing Tint / Background color of UITabBar

Resources