iOS Status bar text and background color. How?
-
Hello all!
Is there any way to change text and background color in Qt for iOS application? All that I found hasn't been useful. In one cases - it's depricated by Apple in other way it's not working. Have anyone experience of changing it? I am seeking solution NOT from Info.plist. I need something to change it directly from application at runtime. -
Hello all!
Is there any way to change text and background color in Qt for iOS application? All that I found hasn't been useful. In one cases - it's depricated by Apple in other way it's not working. Have anyone experience of changing it? I am seeking solution NOT from Info.plist. I need something to change it directly from application at runtime.set your Window flag (QML or QWidgets) to (Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint) that will cover the whole space of your iPhone, and you can define the background from your app.
You'll have to (eventually) manage the safe area manually.
-
set your Window flag (QML or QWidgets) to (Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint) that will cover the whole space of your iPhone, and you can define the background from your app.
You'll have to (eventually) manage the safe area manually.
-
Issue closed. Solution is:
- Setup in Info.plist this value Set the UIViewControllerBasedStatusBarAppearance to NO in the plist
<key>UIViewControllerBasedStatusBarAppearance</key> <false/>
- In main.qml set the flags for Window component
import QtQuick 2.12 import QtQuick.Window 2.12 Window { flags: Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint; color: "red" }
- Create Objective-CPP class and inside of it use this Objective-C code (The example of creating Objective-CPP/Objective-C class published here):
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
and for getting size of status bar use something like this:
float ObjectiveCClass::mStatusBarHeight(void) { return [[UIApplication sharedApplication] statusBarFrame].size.height; }
Be aware of the previous version of code that switching status bar text marked deprecated, something like this deprecated:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Official Apple guide is here https://developer.apple.com/design/human-interface-guidelines/ios/bars/status-bars/
This 3 steps will make for you something like this