0

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.

trial4life
  • 21
  • 8

2 Answers2

0

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;
}
张鸡鸡
  • 1
  • 2
  • Thank you for reply, but nothing seemed to change. I also tried this issue on pure 3.17.1 cocos-2dx demo project. The apps layout covers all screen, so status bar is not visible. I tried to compare parametrs -`[[UIScreen mainScreen] bounds].size.width` and [[UIScreen mainScreen] bounds].size.height in AppController.mm in both projects, and I`ve got the following results: My prjoject: width 320, height 568, Demo project: width 812, height 375. I guess smth is wrong with screen width and height, but I did not find how to change them, maybe because I am new to ios development. Any ideas? – trial4life Nov 01 '19 at 13:34
0

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.

trial4life
  • 21
  • 8