I'm working with SearchDisplayController and want to apply a style or tint to the searchBar.
But I noticed that the SearchDisplayController makes changes to the style of my searchBar.
For example if I use the "Dark Text Color" tint on my searchBar, when running the app, I'll obtain a grey style. But if I remove the searchDisplayController linked to the searchBar, the style in the app is ok.
This image shows the difference between the searchBar in the storyboard and in the app.
Note: If I use the default style, I don't have any problem.
I don't understand what changes the searchDisplayController adds to the searchBar.
Am I missing something or doing something wrong ?
No, you are not doing something wrong. While I'm not sure why it works this way, I can imagine that a somewhat lighter color is chosen in order to distinguish the cancel button (which will have your tint color).
What worked for me was to set the background color to black, no tint color (default), and use the Black Translucent style.
Also remember that when you set a tint color, the style is ignored.
I remember struggling with this for hours, just to get a black search bar.
Related
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:
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];
I am using a UIWebView to display content in an app and would like to change the color of the Done button that is displayed whenever a select control is used.
It is currently displaying as white on gray which is hard to see.
The "Done" button is white because you are probably setting the tintColor to white for all UIBarButtonItems using UIAppearance. That affects the "Done" Button in the picker view which also happens to be a UIBarButtonItem.
So you have to exclude the "Done" button in the picker view from the global white tintColor. I don't know if you only need the white UIBarButtonItems in your navigation bar, but if you do you could do this to only set the tintColor for the bar button items in your navigation bar and leave all other UIBarButtonItems untouched:
UIBarButtonItem.appearanceWhenContainedInInstancesOfClasses([UINavigationBar.self]).tintColor = UIColor.whiteColor()
However this is only available in iOS9 and the old appearanceWhenContainedIn method that works for older iOS versions is not available in Swift.
So, if you are working with Swift and you have to target earlier iOS versions than iOS9 this is probably not working for you. In that case you have to remove the UIAppearance setting for the white tintColor and set the tintColor for the UIBarButtonItems in your navigation bar "manually" without using UIAppearance.
Another possible solution is to just do
UIPickerView.appearance().tintColor = UIColor.blueColor()
put this in your AppDelegate and you are ready to go!
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
I am trying to tint my UI to a nice brown. The pop up associated with the splitter is blackish-blue. How do I change its tint to the one I have applied to the rest of the app?
Here's a picture:
When I change the tint in IB it then looks like this:
Unfortunately the border can not be changed from the grey color..only the title. You need to set the tintcolor property on the navigation bar.
myController.navigationBar.tintColor