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.
Apple released Technical Q&A QA1797: Preventing the Status Bar from Covering Your Views. It works fine for the iOS 6 and iOS 7 versions.
Try this simple method....
Step 1:To change in single
viewController
Step 2: To change in whole application
Step 3: Also add this in each
viewWillAppear
to adjuststatusbar
height foriOS7
I have achieved status bar like iOS 6 in iOS 7.
Set UIViewControllerBasedStatusBarAppearance to NO in info.plist
Pase this code in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
methodIt may push down all your views by 20 pixels.To over come that use following code in
-(void)viewDidAppear:(BOOL)animated
methodYou have to set windowHeight Userdefaults value after window allocation in didFinishLauncing Method like
You can hide the status bar all together. So your app will be full-screen. I think that's the best you will get.
UIStatusBarStyleNone
or set in the target settings.There is an option in the Interface Builder which calls the iOS 6/7 Delta property which aim to solve the offset problem.
Take a look at it in Stack Overflow question Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?.
In order to continue working with setStatusBarHidden: I use this category: