How to hide status bar in ios13 in cocos-2dx

How to hide status bar in ios13 in cocos-2dx
0

Hi everyone,

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/>

but nothing seemed to work.

this works for me… you also need to go to project->General->Status Bar Style
set it to requires fullscreen and hidestatus bar

Hi, Ive got the same problem. Ive checked the project->general->Status Bar Style and I already have checkboxes
requires fullscreen and hidestatus bar checked.

@VBilokin @whoami23041990 what devices did you test on? Can i use cpp-empty-test to reproduce it?

It works for me as well.

device is iphone XR

I 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 something is wrong with screen width and height, but I did not find how to change them, maybe because I am new to ios development

Finally, I found the reason for that.
my project was missing launchscreen storyboard.
Adding launchscreen storyboard https://stackoverflow.com/questions/46184859/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.

1 Like