Why does my status bar disappear after a couple of seconds Xcode? - ios

When I run my app on simulator or device, my status bar (time, battery, service) is visible for about 2 seconds during the launch screen and then disappears and doesn't come back.
I have tried many variations within the info.plist file, changing View controller-based status bar appearance to YES and NO. trying different Status bar style and Status bar is initially hidden combinations. I don't know where i am going wrong.
EDIT:
I have rebuilt the whole app as a trouble shoot but it does the exact same thing still. Does anyone know what else I can try? I have spent two days searching for answers.
Can someone please help me?

I found the answer. I changed the IOS_IS_WINDOWED variable in my main.m file from False to True :)
putenv("IOS_IS_WINDOWED=True");

Related

Weird padding at top UINavigationController while animating to detail in iOS11

I'm posting here because I'm completely lost on this one.
I've searched all over the web, tried a lot of things myself, and searched weeks on this bug, but I can't find it.
So ever since iOS 11 (doesn't happen on iOS 10), everytime I press a button that activates the "show" segue in a UINavigationController the animation shows some weird padding at the top.
This padding disappears when the animation is finished.
I've changed the backgroundcolor of the superview to a red color, and the space you can see is indeed from the superview itself, so my guess is the whole UITableView is being moved down for some reason, although I'm not sure what exactly is the cause here.
(I'm using storyboard and AutoLayout constraints)
Another thing I noticed is that the spacing/padding you see is different on the iPhone X compared to the other devices (my guess is that it's the same height as the (non)safe area at the top? Again, not sure.
I don't think code is necessary to be provided here, as I wouldn't really know which part causes this behaviour (and there's a lot of code that I can't share for reasons..).
Any suggestions/help on how to fix this would be deeply appreciated!
Here are some examples:
iPhone X running iOS 11.1 (also happened on 11.0)
iPhone 8 gif
EDIT: I should add, some things I already tried:
tableView.contentInsetAdjustmentBehavior = .never
Setting headerviews to 0
tableView.setContentOffset(0, animated: false)
Playing with the translucency settings of the UINavigationBar
AutomaticallyAdjustContentInsets is set to false
So, as suggested by Spenser-Arn, I played around with the constraints and the Safe Areas, turns out, the safe areas where the cause of the issue.
Hope this helps other people as much as it helped me, and a big thankyou to Spenser-Arn!

Removing unnecessary titles and icons at the top of iOS Simulators

I'm new to iOS and my question will seem little bit confusing to you but it make sense I'm working on a project where I have to use a custom NavigationBar while I was working on that I saw these icons and title at the top
and as the requirement of my project I need a Bar like this
and you can see the word slightly overriding my button (the red bar is not a part of my button). so my question is, is there any way we can remove these buttons from our simulator because I noticed when i click on the back button sometimes it'll not work due the fact I was clicking on the that "Carrier" title. Soo is there anyone who knows something about it and please don't suggest me to resize the button or something like that it's not my point if you understand.
As Nobody have Answered it yet let me tell you the answer that I find working:-
To hide status bar in iOS7 you need 2 lines of code
in application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions write
[[UIApplication sharedApplication] setStatusBarHidden:YES];
in info.plist add this
View-Controller Based Status Bar Appearance = NO

How to use setHidesBottomBarWhenPushed correctly?

I used the setHidesBottomBarWhenPushed to hide tabBar when A viewController pushed to B viewController,but in the process ,the navigationBar displayed black background color and then became normal quickly.
I have spent a day to trying to solve this problem,but all ways not working.
Appreciating your help.
Thank you.
I just created a very simple "Tabbed Application" project like this.
Pust to viewController when clicked push barButtonItem,and the "Hide Bottom Bar On Push " property of viewController was checked in storyboard.
The result was :
I met the same problem while using old MacBook (about 2011 early) before. I think it is the render issue of the simulator while using some out-of-dated devices. But actually, when you run your code on real device (iPhone 5 above), this issue is unusual.

Status bar won't go away on scaled up version of iOS 7 app

I have tried everything suggested here: Status bar won't disappear to no avail.
My iPhone version of my app has no status bar shown, but on my iPad, which runs the scaled up version of my iPhone version, there is a status bar that won't go away!
If it makes a difference, my app uses the devices camera for a majority of the app. If you need more info/code, don't hesitate to ask! My app is iOS 7 only, and I use Xcode 5. Also, I would like the status bar gone in the whole app.
Do not suggest UIViewControllerBasedStatusBar in the plist-- it does not work.
Related Articles
https://stackoverflow.com/a/18740897/294884
https://stackoverflow.com/a/21034908/294884
https://stackoverflow.com/a/20307841/294884
For 2016 onwards all you do is:
Add these two items to your plist:
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
1. It is that simple
2. There is no other method.
(Note - there's a (pointless) "hide status bar" checkbox in "general settings" "deployment info" section. This simply reads the plist file, it's a completely pointless checkbox.)
Historic answers...
I've removed the historic answers as they are completely useless. (If any historians need to read it, click "edit history".)
Have you already, on your info.plist file, added two new attributes if not present? Please try setting "Status bar is initially hidden" to "YES" and also set "UIViewControllerBasedStatusBarAppearance" to "NO". This will hide status bar for your app.

Disabling the Personal hotspot notification

Enabling personal hot spot pushing down the view and related subviews pushing down. How to disable the personal hotspot notification programmatically? (how can i restrict iPhone status bar to original size even when HOT SPOT is on?)
I found rather late that the Personal Hotspot doesn't just add 20points to the status bar, it messes up views that rely on drop points in an animator with gravity. I added code that checks the status bar height before laying out the views. If it's not 20, then it's probably the hotspot, so I just hide the status bar. Not an ideal solution, but works so far.
- (BOOL)prefersStatusBarHidden {
if ([UIApplication sharedApplication].statusBarFrame.size.height == 20) {
NSLog(#"Status bar is 20 so returning NO for hidden");
return NO;
}
NSLog(#"Status bar is not 20 so returning YES for hidden");
return YES;
}
If you disable statusbar then automatically disable Hotspot bar.
The Apple documentation is not very descriptive of the status bar, esp. the 2nd row that appears when you are using hotspot, map, calls, etc.
Even if more than one is running, there is only one additional row.
I don't know how 3rd party apps appear, but the questioner asked specifically about Personal Hotspot which is a system service.
I doubt the display can be controlled by anybody, except when the user turns the service off.
You probably have to do it the "hard" way". You should hide the main status bar, then draw your own custom status bar.
BTW, Apple says not to do this:
Use the system-provided status bar. People expect the status bar to be consistent systemwide. Don’t replace it with a custom status bar.
https://developer.apple.com/ios/human-interface-guidelines/bars/status-bars/
It's an alternative way but it works.
First include a new key in your project's Info.plist:
Status bar is initially hidden: YES
And then, in your AppDelegate, at didFinishLaunchingWithOptions you can set:
[application setStatusBarHidden:NO];
This will hide the hotspot bar during launch screen and then show it again when the app launches.

Resources