How to change iOS app's background image? - ios

I want to change my app's whole background image to black, including the status bar and navigation bar, because I want to use black underpainting and gray font color. How can I do this?

You can change the view into UIButton, UILabel, UIImageView, etc.
view.backgroundColor = [UIColor blackColor];

Related

iOS programmatically change all default colours

This code in applicationDidFinishLaunchingWithOptions()
window?.tintColor = .red
window?.backgroundColor = .green
change the default views tint color, not the background color, of my whole application, which is a double view with table view.
The default text color is a black "Color Dark Text" in label texts, and a black "Color default" in text fields.
Is there a way to programmatically change all the defaults color, foreground and background?
Yes, you can do it via appearance. E.g. to change backround color of every view:
UIView.appearance().backgroundColor = .green
Note: If you change background of some view, appearance will not apply.

iOS get other color than programed

I want to change the color of the navigation bar.
I declared a variable called "mainColorBlue" and set the navigation bar to mainColorBlue.
UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];
This is the color R18 G86 B136.
Now, if I launch the app on my device, but the color of the navigation bar is R39 G97 B139 and not R18 G86 B136
What I have to do, that the color is the same?
Make sure the tint color and the background color are the same. Nav bars can be weird with colors.

How can I set the correct Nav Bar tint color?

I am creating a title view in my navigation bar. I designed my title view with background view color R:255 G:182 B:22 (on photoshop). In my storyboard, I've set the navigation bar tint color with the same RGB code, default style and translucent checked.
I put my image on my navigation title using:
UIImage *titleImage = [UIImage imageNamed:#"Icon-Small-40.png"];
self.navigationItem.titleView = [[UIImageView alloc]initWithImage:titleImage];
When I run the app, you can clearly see a square icon in the title view. The title view has a slightly darker background. I want to make the background the same color. I get the feeling that it has something to do with some storyboard setting but I can't find the issue.
the view has a tintColor property, so
self.navigationItem.titleView.tintColor = ...
Below answer for your navigation bar tint color
self.navigationController.navigationBar.tintColor = [UIColor greenColor];
Trying to make colours match up like this can be maddening. Colour space problems aside, the actual colour of the navigation bar isn’t guaranteed by the API to be the same as its barTintColor. You might find it easier to give the title image a transparent background.

Hard time setting color on status bar (iOS7) with transparency

I would like my status bar to be black and be 25% transparent. I understand that the status bar is transparent by default, and therefore takes on the color of the background. However when I set the views backgroundColor:
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.75f];
The status bar is completely black.
I have a toolbar which I set to black with an alpha of .75 and I am just trying to get them to match:
self.toolBar.tintColor = [UIColor whiteColor];
self.toolBar.barTintColor = [UIColor blackColor];
self.toolBar.alpha = .75f;
Any reason why the background color on the UIView is not respecting the alpha component?
EDIT:
Based on comment that view does not underlap the status bar. If I set background to green it shows that it works:
However if I start to add transparency to the green color, it does not get lighter it gets darker. Seems like the default is to be black underneath my only UIView, not white.
self.view.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:.25];
The status bar in iOS 7 is completely transparent. The problem may be that your view and the toolbar are not correctly underlapping the status bar. So you are seeing the black window behind it. (Or, in fact, you may setting the size of the window incorrectly, in which case you are seeing nothing at all behind the status bar.)
If the view does underlap the status bar, then you need to set the bar positioning of the toolbar to Top Attached so that its height increases up underneath the status bar. We should not be seeing a separate color for the status bar; it should appear to overlay your interface, lying in front of the top of the toolbar.

Removing the default tabbar color iOS

i want to place the background image to default tabbar here i added the code for background tabbar background image but it appears both my background image and also default tabbar also please suggest for removing the default tabbar black color image .Plz refer the below image for better understanding
Thanks in advance
Try with this code:
// this will generate a gray tab bar
tabBarController.tabBar.barTintColor = [UIColor grayColor];
tabBarController.tabBar.translucent = false;
// this will give selected icons and text your apps tint color
tabBarController.tabBar.tintColor = [UIColor redColor]; // appTintColor is a UIColor *

Resources