How to set the Transparent statusbar in iphone - iphone

In my application i want to set the statusbar transparent.There are three styles are possible for changing the style of the statusbar.
gray
black
black translucent
mycode:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
How to set the transparent statusbar?

The best solution for this problem is to set self.wantsFullScreenLayout = YES; in your view controller and [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; for your status bar.
UPDATE:
As Mihir Oza told in comments the UIStatusBarStyleBlackTranslucent constant from old version of my answer is now deprecated. Use UIStatusBarStyleLightContent instead.

For the global app in the info.plist add Status bar style: Transparent Black Style (alpha 0.5).

The best way of doing this is with info.plist. Have a look at Apple's UIKit pList keys, specifically UIStatusBarStyle (and the value UIStatusBarStyleBlackTranslucent) for making it translucent, or the UIStatusBarHidden key (for hiding it totally).

It's not possible to make the status bar transparent. There are only 3 possible styles (gray, black and black translucent) you can set and you cannot get the bar's UIView.
However if you have static content behind it (i.e. a fixed part of your UI that you can edit) you can set the status bar to black translucent and add a 50% white layer just behind the bar. This makes the bar appear to be transparent.
Here's an example of what I mean.
See an example http://cl.ly/7WST/Untitled-1.png

In the info.plist set status bar style Transparent black style (alpha of 0.5).
In viewcontroller.xib set size fullscreen and status bar none.
In viewcontroller.m add following codes in viewWillAppear:
self.view.frame = CGRectMake(0,0,320,480);
This worked for me.

You can only hide the status bar using Status bar is initially hidden property in your info.plist

Related

Overlaps the status bar on view iOS7

I have develop the my iPad application in ios6 but now i want to develop that application in ios7 also , I am using .xib file and I am not using the AutoLayout i want to use the black status bar in my application and i want to make the application similar like ios 6 but the status bar is overlap on the view i use the different code like below link
Link 1
Position of navigation bar for modal view - iOS7
Link 2
iOS 7 - Status bar overlaps the view
Thanks in Advance
wont happen, two options:
use a custom background image that is sized accordingly.. IIRC 44 (for navbar) + 20 (for status bar)
OR
account for the 20 pixels by using a custom view which is black :D
In iOS 7, the status bar is transparent, and other bars—that is, navigation bars, tab bars, toolbars, search bars, and scope bars—are translucent. As a general rule, you want to make sure that content fills the area behind the bars in your app.
Because the status bar is transparent, the view behind it shows through. The style of the status bar refers to the appearance of its content, which includes items such as time, battery charge, and Wi-Fi signal. Use a UIStatusBarStyle constant to specify whether the status bar content should be dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent):
UIStatusBarStyleDefault displays dark content. Use when light content is behind the status bar.
UIStatusBarStyleLightContent displays light content. Use when dark content is behind the status bar.
In some cases, the background image for a navigation bar or a search bar can extend up behind the status bar. If there are no bars below the status bar, the content view should use the full height of the screen.
In iOS 7, you can control the style of the status bar from an individual view controller and change it while the app runs. If you prefer to opt out of this behaviour and set the status bar style by using the UIApplication statusBarStyle method, add the UIViewControllerBasedStatusBarAppearance key to an app’s Info.plist file and give it the value NO.
For more details about how to use status bar with navigation controller, please refer my answer here.
Try below to do not overwrite status bar:
[navController.navigationBar setBackgroundImage:[UIImage imageNamed:#"navBar.png"] forBarPosition:UIBarPositionTop barMetrics:UIBarMetricsDefault];
A workaround to use the old style status bar is to modify the frame of the main view and shift it down 20px. This will only work on viewWillAppear function but you need to make sure you call this once. This is more of a hack than a solution:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view setFrame: CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+20, self.view.frame.size.width, self.view.frame.size.height-20)];
}

Remove UINavigationController rounded corners

How can i remove the UINavigationController top rounded corners?Is there any plist property or i need to do this programmatically?
I want to go from this:
To this:
Just change the status bar style from "Black Opaque" to "Black Translucent" and all 4 corners of your rootViewController won't be rounded anymore. As long as you don't set your view controller's property wantsFullScreenLayout = YES nothing will be drawn behind the status bar. Your UIWindow must have backgroundColor = [UIColor blackColor] so the user can't notice that the status bar isn't real "Black Opaque".
Well, the default look is the look in the image on the bottom. So what did you do, to get the look of the top image in the first place? My guess is, that you use an image as the background of the UINavigationBar. Find the image and replace it with a version without rounded corners.
An alternative is a UINavigationBar subclass. In that case you might look for that subclass and see if there is a line similar to [self.layer setCornerRadius:3.0] and remove it.
I believe Sascha may be correct when he says that rounded corners are automatically added when you use a black status bar. I noticed that in one of my new apps, my UINavigationController had rounded corners and a black status bar, even though i had not set it in the xib file, the info.plist file or even the App Delegate.
I did a quick test and swapped the image I was using for the UINavigationController/NavigationBar background and discovered that the nav bar color was automatically affecting the status bar, which in turn was rounding the corners of the nav bar (weird)
See snapshots of my nav bar (The rounded corners are being generated purely by virtue of the color of the image I am using as my UINavigationController's background!)
So I guess in your case - One suggestion would have been to try a different color background and see if you have the same results as I did.

Why does my UINavigationBar change colors when I run my app?

I'm building an iPad app using storyboards. In Interface Builder (XCode 4.5), the nav bar is the default (light grey) color...
However, when I run the app, it changes color to a dark grey...
Has anyone else had this problem? No matter what color I set it to in Interface Builder, it always ends up dark grey when I run it.
Thanks so much in advance for your wisdom!
In iOS 6 the status bar have the same color as the navigation bar.
You can customize that, according to the answers to this question:
How to change Statusbar on Modal Views iOS 6
You can colorize your navigation bar with the following line of code, just use it and you nav bar is always light gray:
[[navController navigationBar] setTintColor:[UIColor lightGrayColor]];
When you set the navigation bar color in interface builder, this only affects the view you get in IB itself, it is only a design help. The real color you have to set in code.

Why is the tabBar still black even after I set opaque to NO, alpha to 0, and color to clear?

As above, I can't seem to change the background color or image of the tabBar. Even when hiding it by changing alphan 0, I still see it as a black solid bar.
How can I fix this?
Try this piece of code:
[tabBar setHidden:YES];
If you're trying to set an image for the background, try this:
[tabBar setBackgroundImage:myImage];
There is nothing behind the tab bar. The views of the view controllers that tab bar controllers manage do not extend into the area occupied by the tab bar.

iPad style navbar on iPhone app

Hey, on iPad the navigation bar is normally silver and on the iPhone it's normally blue. Is there any easy way to make the silver navbar on iPhone app?
Thanks!!
If you just want to change the color of your navigation bar, the easiest way to do this would be to add your navigation bar in IB, then click on the navigation bar's attributes panel. Change the tint color to whatever color you would like in there and it will show up accordingly on your app. Similarly, if you are adding the navigation bar programmatically, you should be able to set the tint color yourself with something along the lines of myNavBar.tintColor = [UIColor someColor];. I hope this helps.
As of iOS 5 this can be easily achieved without any manual tinkering. Read this up.