Changing the colour of Navigation Controller bottom toolBar - ios

I am trying to change the colour of the bottom bar of my Navigation Controller. I have managed to change the top NavBar in my appdelegate by adding
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.688 green:0.437 blue:0.794 alpha:1.0]];
I want to apply this to the bottom bar also.

You can use [UIToolbar appearance] to set the appearance of UIToolbar
Good luck

I had the same problem, but could escape this by setting a tag for my navigationBar in my storyboard. Then I could change the navigationBar's color like this:
let navigationBar = (self.view.viewWithTag(someNumber) as UINavigationBar)
navigationBar.barTintColor = UIColor.blackColor()
This is not ideal unless you can guarantee that the number of subviews in your view is less than "someNumber". If you can though, then this should work.

Related

Is there a way to change the back button color when using the navigation controller in Xcode [duplicate]

I'm having problems trying to figure out how to change the color of the buttons on the navigation controller.
Previously I had used the following:
[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:226/255.0 green:66/255.0 blue:66/255.0 alpha:0.0]];
and this worked, but I added a new view with a toolbar, and the tool bar button images will not show. If I remove the global coloring, the tool bar items show just fine.
I've tried setting the tint color on both the leftBarButtonItem and the backBarButtonItem in the viewDidLoad method of the view, but both of those properties appear to be null.
I don't want to change the color of the entire navigation bar, just the buttons. Is there a way to do this?
Yeah, I'll just post this as an answer. Your alpha is set to 0. So you're basically saying the same thing as [UIColor clearColor].
Not sure how that ever worked to give you a tint color on your bar button items.
In swift, it can be accomplished by the following command:
if let navController = self.navigationController
{
navController.navigationBar.tintColor = UIColor.whiteColor()
}

iOS double navigation bar by set translucent OFF

at First:
I work with the storyboard interface builder...
I tried to color my navigation bar like Instagram:
UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];
[[UINavigationBar appearance] setBarTintColor:mainColorBlue];
[[UINavigationBar appearance] setBackgroundColor:mainColorBlue];
But if i set the color to mainColorBlue, it is not this color. I've read in the internet, that it is cause from translucent. So I set translucent to OFF.
But now, my Problem is: If i deactivate the translucent and activate opaque and start the app on my external device, under the navigation bar is another navigation bar. If i switch the translucent to ON again,the second navigation bar isn't shown.
What i have to do, that the second navigation bar disappear?
I resolve the problem.
I added a subview on position 0,0 to color the statusbar.
UIView *statusBarColor = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
statusBarColor.backgroundColor = mainColorBlue;
[self.view addSubview:statusBarColor];
So this View is displayed under the navigation bar. I removed this code and now it works.

When the UITabbar is Translucent and the UIViewController is not extended behind the tabbar, the uitabbar seems like covering a black view

The tabbar in first view is what I want. Because the second view isn't a scrollview, so I can't extend it to bottom by using self.edgesForExtendedLayout = UIRectEdge.Bottom.
It looks unacceptable.
And I don't want to set Translucent of uitabbar to false, it's not fancy.
I try in another way:
[[UITabBar appearance] setBarTintColor: [UIColor whiteColor]];
It doesn't work. To make it looks more clear, I change the color to red. And the last tabbar also looks like covering some black views.
Consider of the tabbar is translucent, what's the view under the UITabbar view?
This is the final answer of why it doesn't work when changing the tintcolor of bar. Because the view under UITabbar view is black.
Thanks to the Xcode awesome debugging function. We could locate the view under UITabbar view easily.
It's UIWindow. So the solution is to simply change the window's backgroundColor to white.
I would say that adding this code in viewDidLoad of your viewController will solve your issue:
edgesForExtendedLayout = .all
extendedLayoutIncludesOpaqueBars = true
Plus you can keed your tabBar translucent and not set any background color.

Navigation Bar color and a View's color

I'm getting a weird, i have a navigation bar and a view that is right under it.
I set both of them to [UIColor BlueColor], but at run time the outcome is that the nav bar has a slit darker color then the view.
Any knows what causes this?
Thanks
Your problem is that the navigation bar is translucent, and therefore the bar color is put on top of the view's color, making it appear darker. Try making the bar not translucent.
navigationBar.translucent = NO;
You can try this one:--
navigationController.navigationBar.barTintColor = [UIColor greenColor];
or
[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];

How to make a custom UIView to combine with UINavigationBar make it looks as one

As you can see below, the three buttons: STORE,AREA and All. These buttons looks like the UINavigationBar and them are combined together. I tried in storyboard, I added a custom UIView and try to set it's colour match the UINavigationBar background color. But it always has differences, and I can see the border line between UINavigationBar and the custom UIView. How to make a UIView to combine with the UINavigationBar to make it all looks like they are combined.
iOS 7 has shadow next to the navigation bar. Try below to remove that shadow:
if (IS_IOS7) {
[[UINavigationBar appearance]setShadowImage:[[UIImage alloc] init]];
}
You can change the navigation and status bar background only in iOS7. For this, you can use
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"nav_bg.png"] forBarMetrics:UIBarMetricsDefault];
The size of the nav_bg.png should be 320*64 px
If you want to simply change the color of navigation bar you can use
[[UINavigationBar appearance] setBarTintColor:[UIColor blueColor]];

Resources