how to hide UIStatusbar on the ipad? - ipad

i was create the app for target for iphone in ios7. but when i tested that app into ipad then statusbar not hidden. in iphone its hide but not into ipad. please help me. i set the below code on my app.
i set this to appdelegate. but its not hide the statusbar for ipad.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
i also set the View controller-based status bar appearance to NO and Status bar is initially hidden to YES into info.plist file.

Your code is correct, but since iOS 7 the iPad works slightly different with iPhone compatibility mode: the status bar is always visible, and there is no longer a 2x button to show the interface "zoomed in".
Even though your code will work fine on iPhone, the iPad will always display the status bar on iPhone apps.

Related

Status Bar Text Color on iPhone XR is different

Already checked answers from StackOverflow to change status bar color for the whole app is to set View controller-based status bar appearance in info.plist to NO and Status bar style to UIStatusBarStyleLightContent.
Well it did change from iPhone XS and lower, but iPhone XR and iPhone XS Max were not, Still solid black. I tried to find in code if there is a code that called UIStatusBarStyleDefault but I dont see it anywhere. My current fix now is to put this [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; on didFinishLaunchingWithOptions. Any thoughts? Thanks
In iOS 12, setting NO at View controller-based status bar appearance in Info.plist won't work anymore; you must set it to YES. Your workaround is the recommended way to do so.
Reference: https://stackoverflow.com/a/52443917/188331

Status bar behave weird in landscape mode on iOS 8.1 and work fine with iOS 7.1

I am having very uncommon problem. Im my application the status bar does not show in landscape mode. This issue happen only for iOS 8. It work fine in iOS 7. Please see the attached screen shots for both iOS 7 and iOS 8.
This may help you
In Plist set View controller-based status bar appearance: NO
and add the code in your view Controller
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
check if you got any code similar like:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
and besides, you need to check if in your storyboard, or xib related, if any status bar is set to none

How to set status bar hidden for entire app in iOS?

I am trying to set the status bar of my entire iOS app hidden. (The app deployment target is set to iOS 7.1).
I have tried the following (and none worked):
Adding this line to application:didFinishLaunchingWithOptions: in AppDelegate.m :
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
and also this line:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
I have tried setting the statusBar to None for each of my View Controllers in Storyboard View --> Attributes inspector --> Simulated Metrics.
I have tried adding the key Status bar is initially hidden as YES in Info.plist file of my app.
None of these worked. Can anyone guide me as to what is wrong?
Btw, I am using the latest version of XCode on my Mac and latest iOS on my test device. And, all my View Controllers have been set to Landscape mode only in Attributes inspector. And the supported orientations of the app are Landscape both sides.
Just set both properties in your .plist file.Then you will be good to go.
1.View controller-based status bar appearance -No
2.Status bar is initially hidden-YES
Hope this will help!
Have you tried setting:
View controller-based status bar appearance
to NO
In your Info.plist file?
In your info.plist file, there's a setting called "Status bar is initially hidden." Set that to "YES," and you won't have it at startup. Then you don't need to do anything in your code, the bar will show up when your app is launched.

Hidden status bar intercepts touchs on iPad

In my app I'm using UI for several first screens, and then switch to OpenGL view controller (cocos3d). I show status bar for UI view controllers, and then hide it before switching to OpenGL.
The strange thing is, that while running the app on iPhone all is good, but on iPad the hidden status bar starts to intercept all touches within its bounding box.
I have found this question, which refers to this one. There seems to be a bug of Simulator with the same behavior, but I encounter this on real devices (both iPhone and iPad are real devices).
I'm creating OpenGL view controller programmatically without differentiating like
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
In my .plistI have:
View controller-based status bar appearance = NO
To hide status bar I'm using:
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Also, I'm targeting iOS 7.
I've almost got crazy about this, does someone encountered the same issue? How can I allow touches for status bar area?
Try putting this in the .m of the viewcontroller
- (BOOL)prefersStatusBarHidden {
return YES;
}

adapting to iOS 7 on iPad

I need to adapt an app to iOS 7, and I'm having troubles when being run on iPad, since the size of the screen is a little cut off on both bottom and top, as in the image.
I tried to follow some guidelines (such as this) but no luck.
It works on normal iPad 1 on iOS 6 and iPad 2 on both iOS 6 and 7, but it's just in a reduced size (not no cut off images whatsoever).
Could anybody give me some hints please?
Thanks a lot in advance.
I solved this creating a boolean in my Info.plist with the title View controller-based status bar appearance and a value NO.
Thanks everybody for the help!
As #noloman said: Set the following in your .plist
View controller-based status bar appearance (Boolean) to NO
I would suggest this also:
Status bar is initially hidden (Boolean) to YES
And call the following within the application when necessary:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
(For example: When a MPMoviePlayerViewController* is returning from playing a video (as the status bar is shown))

Resources