Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. iOS Status bar text and background color. How?
QtWS25 Last Chance

iOS Status bar text and background color. How?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bogong
    wrote on 20 Mar 2020, 13:43 last edited by bogong
    #1

    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.

    J 1 Reply Last reply 20 Mar 2020, 14:13
    0
    • B bogong
      20 Mar 2020, 13:43

      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.

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 20 Mar 2020, 14:13 last edited by
      #2

      @bogong

      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.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply 20 Mar 2020, 15:38
      0
      • J J.Hilk
        20 Mar 2020, 14:13

        @bogong

        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.

        B Offline
        B Offline
        bogong
        wrote on 20 Mar 2020, 15:38 last edited by
        #3

        @J-Hilk But what about text?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bogong
          wrote on 23 Mar 2020, 15:42 last edited by bogong
          #4

          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

          Screenshot 2020-03-23 at 18.38.57.png

          1 Reply Last reply
          1

          4/4

          23 Mar 2020, 15:42

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved