Qt on iOS: Status Bar Color



  • Hi all,

    First, I would just like to thank you for at least taking the time to read this.

    I would like to clarify what I am referring to by saying "status bar", because I know that there is some ambiguity as to what a status bar could be. For my case, I am talking about the 20px high bar that shows battery information, time, carrier, etc. I want to set the color of the status bar to make the app look native.

    Typically, as of iOS 7, the color of the status bar show the color of the application's UINavigationBar. With Qt, I don't think that I have access to this. With a typical Cocoa application, the code would simply look like this:

    @ [[UINavigationBar appearance] setBarTintColor:[UIColor yellowColor]];@

    There is also a property in Xcode called "View controller-based status bar appearance" that you can set to "NO", and this will make the color of the status bar independent from the navigation bar. However, I'm not aware of any way to set the color from this approach.

    Again, I would like to say that this problem is just nit-picky and trivial, but my app would look better if I can manage to change the status bar color.

    Is anyone able to point me in the right direction or offer suggestions?



  • I have a same problem. Did you find a solution to change it?



  • No, I haven't found a solution yet. For now I have the status bar set to hidden in the info.plist file. I have a QML item that does the same thing as a UINavigationBar, and I just made that a bit higher.



  • Ok. Thanks for info.


  • Qt Champions 2016

    In case you are still looking for a solution of this problem...

    In fact, what you need is set "UIViewControllerBasedStatusBarAppearance" be false in Info.plist. Then show your application in full screen mode and draw the status bar background by yourself.

    The following commit has demonstrated how to set Info.plist:

    https://github.com/benlau/quickios/commit/c8a3eb5744ba8b19aeb8b8d8babd9f8200d7455e

    p.s the project is not usable yet.


  • Qt Champions 2016

    In case you are still looking for a solution of this problem...

    In fact, what you need is set "UIViewControllerBasedStatusBarAppearance" be false in Info.plist. Then show your application in full screen mode and draw the status bar background by yourself.

    The following commit has demonstrated how to set Info.plist:

    https://github.com/benlau/quickios/commit/c8a3eb5744ba8b19aeb8b8d8babd9f8200d7455e

    p.s the project is not usable yet.


  • Lifetime Qt Champion

    Hi,

    About this

    @ [[UINavigationBar appearance] setBarTintColor:[UIColor yellowColor]];@

    You can mix C++ and Objective-C code so it's probably working (haven't checked though)


  • Lifetime Qt Champion

    Hi,

    About this

    @ [[UINavigationBar appearance] setBarTintColor:[UIColor yellowColor]];@

    You can mix C++ and Objective-C code so it's probably working (haven't checked though)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.