iOS UISearchBar always translucent - ios

I have UISearchBar and I have set the Translucent property to false both in the Xcode editor and in code.
However the UISearchBar always remains translucent and it looks terrible next to my navigation bar, which I have also set the Translucent to false.
How can I set the UiSearchBar bar tint color without it being translucent?
Rant:
Why on earth would iOS not let you set the color of a component exactly as you want it? To sneakily alter the color in the background is unbelievable!
Edit
Code to set the translucent to false.
historySearchBar.Translucent = false;
Designer set translucent off.
Result is still a translucent UISearchBar.

Related

Why the navigation bar tint color is faded?

I'm currently working on an iOS application in swift. Here I have UIView on the top of the screen and have UINavigationController. And I need the topView and navigationBar color to be same. And I gave the topBar background color and navigationBar tint color as same. But when the screen loads, the navigationController is showing a faded color. Why?
I tried through programmatically,
self.navigationController?.navigationBar.barTintColor = UIColor.red
Also, I tried through storyboard, like giving the navigationBar's tintColor as red. But in both ways, it's not working.
Please help me.
Set navigationController?.navigationBar.isTranslucent = false to have a solid color navigation bar.
By default the property translucent is set to yes which desaturates any color applied to the navigation bar.
To disable this behaviour just select the navigation bar in your storyboard and disable the checkbox labeled "translucent" in the attribute inspector.

Navigationbar Color confusion

Environment: Xcode 8 and iOS 10.
I am try to set navigation bar color without writing codes.
This is my main UI color when the app is launched. I plan to set the Navigation bar with the same color. However, the color is a little light when it is tested.
As you can see, the color in Navigation bar is a light shade. I set the navigation bar color in the property attribute.
How to resolve this? Thanks in advance.
In attribute inspector, try unchecking Translucent property. And set Bar Tint property to your desired color.

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.

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.

Frame shifted up / empty space between view frame and tab bar with tab bar translucent set to "NO"

Here's my scenario:
I have a UITabBar that is using all the default settings and my app's tab bar translucency boolean is set to YES.
I wanted to change the colors of my tab bar, so I set the (iOS 7) tab bar's barTintColor to [UIColor whiteColor].
However, when I saw the app, this tab bar wasn't as white as it should be. After some time looking through the code, the culprit was the translucency of the tab bar. After setting it to "NO", my tab bar was definitely white. However, when I pushed to my next view controller, there was a black space between my view frame in any view controller and the tab bar. setting the tab bar's translucency to YES would get rid of this problem.
I'm not sure what code I can post since I don't do anything special in viewWillAppear or viewDidLoad in my viewcontrollers (other than setting some custom properties for my feature-set)
Any suggestions? Thanks.
edit: I also tried setting a white image in place of the tab bar's background and it did the same thing even though the translucency was set to "YES" this time.

Resources