In iOS 7 the UIStatusBar
has been designed in a way that it merges with the view like this:
(GUI designed by Tina Tavčar)
It is cool, but it will somewhat mess up your view when you have something at the top part of your view, and it becomes overlapped with the status bar.
Is there a simple solution (such as setting a property in info.plist) that can change the way it works [not overlapping] back to how it is in iOS6?
I know a more straightforward solution is to have
self.view.center.x
+ 20 points for every single view controller, but changing them will screw other dimensions up (having a differentself.view.center.x
can cause problem to custom segues, etc.) and suddenly it turns into a tedious job that is best to be avoided.I'll really be glad if someone can provide me an one-liner solution for this.
P.S. I know I can hide the status bar by doing things like having
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
In didFinishLaunchingWithOptions
method, but that's a workaround, a shortcut avoiding the problem, so I don't consider that a real solution.
SOLUTION :
Set it in your viewcontroller or in rootviewcontroller by overriding the method :
This might be too late to share, but I have something to contribute which might help someone, I was trying to sub-class the UINavigationBar and wanted to make it look like ios 6 with black status bar and status bar text in white.
Here is what I found working for that
It made my status bar background black, status bar text white and navigation bar's color white.
iOS 9.3, XCode 7.3.1
My solution was to add a
UIView
with height of 20 points on top of the window when on iOS 7. Then I created a method in my AppDelegate class to show/hide the "solid" status bar background. Inapplication:didFinishLaunchingWithOptions:
:Then I created a method to fade in/out the black status bar background:
All I have to do now is call is
[appDelegate showSolidStatusBar:YES]
when needed.I found here is the best alternatives and solution for this navigation bar issue in iOS7!!
http://www.appcoda.com/customize-navigation-status-bar-ios-7/
I hope it will clear our all queries and worries.
I have viewed many many many many and many tutorials to fix this darn problem. But none of them works! Here is my solution, and it works for me:
The logic is simple. I shift all children views on the self.view with 20 pixels. That's all. Then, the screenshot will display just like as iOS 6 did. I hate the iOS7 status bar! ~"~
The easiest way to do so is installing an older SDK to your newest Xcode.
How to install older SDK to the newest Xcode?
U can get the iOS 6.1 SDK from http://www.4shared.com/zip/NlPgsxz6/iPhoneOS61sdk.html or downloading an older Xcode and geting the SDK from its contents
Unzip and paste this folder to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Restart the xcode.
Hope it helps you. It worked for me =)