UIToolbar incorrect colour in iOS7 - ios

When I set the bottom UIToolbar to black on the view controller, it appears as a more greyish colour (the same thing happens with other colours--it sort of fades them out). What I assume is happening is that in iOS7 the toolbar seems to adapt the colour of what is beneath it (currently white) which makes for the duller colour.
I've updated the view controller so that the "extended edges" options are turned off but still get this effect. Has anyone else had this issue yet?
UPDATE:
I resolved the issue by setting the background colour of the UIToolbar to black (something I haven't had to do in previous versions of iOS). If anyone can think of a better solution, let me know.

All tool- and navigation bars in iOS 7 have a translucent property.
This causes the effect, where the background shines through in blurred form (just like the control center).
Just set YourToolbar.translucent = NO;.

SET the t*ranslucent property to NO*:-
IN iOS 7 you need to set the barTintColor Property-
UIToolbar *doneToolbar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 584, 320, 44)];
doneToolbar.translucent=NO;
doneToolbar.barTintColor=[UIColor blackColor];
[self.view addSubview:doneToolbar];
I have used it its working fine...

setting the background color instead of the bar tint worked for me
I set the bar tint to default, the translucent property to NO and the background to the color i wanted and it worked for me.

Related

iPhone not displaying accurate color

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];

Blurred translucent navigation bar in iOS

I'm trying to get this blur-translucent navigation bar effect (The first navigation bar in the image) in my Swift iOS application:
But I can't get this done. I've tried several methods, some of them are below:
setBackgroundImage, shadowImage and translucent attrs in AppDelegate (Getting the NavController from the RootViewController attr)
Those lines in AppDelegate main method:
UINavigationBar.appearance().translucent = true;
UINavigationBar.appearance().barTintColor = UIColor(white: 1, alpha: 0.4)
Changing attributes from UIBuilder
Setting self.automaticallyAdjustsScrollViewInsets = true and self.edgesForExtendedLayout = UIRectEdge.None in viewControllers
But still can't get this to work. I'm running the app on XCode simulators, using iOS 8.1 and 9.0
What I am doing wrong?
The second navigation bar is already translucent and blurred—it just isn't quite as translucent as the first navigation bar. If you open Digital Color Meter and mouse over your screenshot, you can see that the background of the second navigation bar is darker in the area covering the image.
The reason why the first navigation bar is more translucent than the second navigation bar was explained in this question: the screenshot of the first bar was taken from a device running iOS 7.0.2, whereas the screenshot of the second bar was taken from a device running iOS 7.0.4. Apple changed the behaviour of UINavigationBar between those versions of iOS, and again with iOS 7.1.
Apple explains the current translucency mechanism as follows:
A translucent bar mixes its barTintColor with gray before combining it with a system-defined alpha value to produce the final background color that is used to composite the bar with the content it overlies.
The only description of the blur effect appears to be the following:
Navigation bars are translucent by default in iOS 7. Additionally, there is a system blur applied to all navigation bars.
You can change the transparency of the bar by using UIImage.imageWithColor: to make a background image for the bar from a UIColor with an appropriate alpha value, but doing so will remove the blur effect. There is no documented way to alter the "system-defined alpha value" to increase the translucency of the bar without removing the "system blur".
If you want to imitate the old translucency and blurring effects on iOS 8.1 and 9.0, you'll need to make your own subclass of UINavigationBar and insert one or more subviews such as a UIView with a background color that uses an appropriate alpha value (for transparency) and/or a UIVisualEffectView (for the blur effect).
You might be able to find a combined view in one of the answers to this question.
Related: Blurring effect disappeared on iOS 7.1
Add bellow code in didFinishLaunchingWithOptions:
For Objective C
[[UINavigationBar appearance] setTranslucent:NO];
For Swift 3+/iOS 10+
UINavigationBar.appearance().isTranslucent = false
Maybe plist changes can fix your problem.

UIToolbar being transparent instead of translucent.

I'm simply adding a UIToolbar above a UITableView.
By default, the appearance of the toolbar should be a whitish translucent color however (like the navigation bar right?).
I am getting an almost fully transparent color (I can totally see through the toolbar into the UITableViewCell contents very clearly).
Does anybody else have this problem?
Here's a screenshot.
I suggest you to check these following helping links upon the Bar color for iOS 7 (UIToolbar and UINavigationBar):
1) http://b2cloud.com.au/how-to-guides/bar-color-calculator-for-ios7/
2) http://www.objc.io/issue-5/iOS7-hidden-gems-and-workarounds.html
And also I suggest you to read the Apple Documentation for UIToolbar Class Reference.

Adding translucent toolbar to navbar causes rendering issue in iOS 7

I have an iOS app that I want to to add more than just 2 items to my navigation bar. One way I have read to do this is to add a toolbar one of your bar button items and then add however many items you want to the toolbar. This seems to work well, except my navbar is translucent (iOS 7 default). This causes the toolbars opacity to overlap with the navbar, causing a noticeable white square if the user scrolls dark content underneath the navbar.
If I could get the toolbar background to be clear, then this would resolve my problem. Does anyone know how to do this, or another way around this issue? Just setting the background of the toolbar to clear does not seem to work.
How about
toolbar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1];

Customizing the UIPopoverController view background and border color

Is it possible to change the border color, navigation bar style/color, and arrow style/color of a pop over view? If so, how? If some sample code is available, then that'll be great!
iOS 7 onwards, you can change backgroundColor of UIPopoverController which affects the navigation background color as well as arrows of popover.
#property (nonatomic, copy) UIColor *backgroundColor NS_AVAILABLE_IOS(7_0);
Usage example:
if ([self.popoverVC respondsToSelector:#selector(setBackgroundColor:)]) { // Check to avoid app crash prior to iOS 7
self.popoverVC.backgroundColor = [UIColor greenColor];
}
Note - As of now (iOS 7.0.3), in some cases (like set color using colorWithPatternImage:), the simulator doesn't honor the color but on device it works fine.
Now in iOS 5, popoverBackgroundViewClass is available.
Unfortunately, UIPopoverController is not customizable like that. You can't change the border color, navigation bar style/color, or arrow style/color: How to customize / style a UIPopoverController.
From ios 5 onward you can do much just try this library https://github.com/ddebin/DDPopoverBackgroundView
you can customise border tint color, bodrer width as well as arrow
look at the documentation
The navigation bar and tool bar inside a popover are just a standard UINavigationBar and UIToolBar, I've had success in changing their appearance just as you would with a normal nav bar or tool bar. The border however is not easily customizable.
You can use ElegantPopover cocoapod to accomplish some of that.
I try to trick it by customizing the viewcontroller inside the popover and then hiding the popover border using this code
UIView * border = [[insideViewController.view.superview.superview.superview subviews] objectAtIndex:0];
border.hidden = YES;
The app is actually still in development so I'm hoping other people will comment on this solution.

Resources