I was using
<key>UIStatusBarHidden</key>
<true/>
in info.plist file to hide status bar for ios. Also in my RootViewController.mm is
- (BOOL)prefersStatusBarHidden
{
return YES;
}
to fix hiding status bar on ios7. Everything worked fine untill I tried this code on ios13. At ios13 status bar does not hide anymore. Does anybody know how to hide status bar for ios13? I also tried to add
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
in info.plist, but nothing seemed to work.
You shoudle View controller-based status bar appearance set is true
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
[UIApplication sharedApplication].statusBarHidden = YES;
or
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
- (BOOL)prefersStatusBarHidden{
return YES;
}
Finally, I found the reason for that. my project was missing launchscreen storyboard. Adding launchscreen storyboard Seeing black bars at the top and bottom of the iPhone X Simulator and hiding safe area https://forums.developer.apple.com/thread/89037 and setting launch screen file in general settings allowed to hide status bar.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.