I want to show the status bar in my app in all views but one. I have tried modifying the 'status bar is initially hidden' in the plist, i have tried:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
That hides the bar but leaves an ugly blue box where the status bar was (which isn't part of my view, there's nothing blue on there).
I have also tried altering the layout wants full screen and status bar settings in the 'interface builder' bit of Xcode 4.2.
Any suggestions?
EDIT - SORT OF SOLUTION:
I have done it by including:
-(void)viewWillDisappear:(BOOL)animated{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
-(void)viewDidAppear:(BOOL)animated{
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
on every single page that I want the status bar to be on.
It still looks choppy and rubbish because the tab bar appears and reappears each time you switch a view. But i've had enough, worked on this stupid problem for about 5 hours now so this will have to do.
SECOND EDIT -
Fixed the choppyness by including setStatusBarHidden=NO in viewWillAppears. God knows how everything works but it does.
To completely hide it on the home screen, open up an app, such as Settings, and wait about three to four seconds. Press the home button again, and the status bar will be completely gone.
You can select from several preset Focuses, such as driving, working out, or reading, or you can set a custom Focus for something you often do. Within the settings it lets you add an identification icon that will appear in the status bar while in use. The trick is you don't actually have to set anything to turn off.
Go to the Storyboard. Select the View and in the Attributes Inspector change the Background Color to Light Gray. Build and Run the Project. The default style of the status bar is dark content.
Try This one It will Run perfectly..
[[UIApplication sharedApplication] setStatusBarHidden:YES];
And in XIB set none option for the status bar.
for iOS 7.
Go to info.plist and add two attributes if not present. set "Status bar is initially hidden" to "YES" and set "UIViewControllerBasedStatusBarAppearance" to "NO". This will hide status bar for your app.
#pragma mark - Hide statusbar
-(void)hideStatusBar {
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
// iOS 7.0 or later
[self setNeedsStatusBarAppearanceUpdate];
#else
// less than 7
[[UIApplication sharedApplication] setStatusBarHidden:YES];
#endif
}
- (BOOL)prefersStatusBarHidden {
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With