Status Bar Text Color

I read on this forum that you cannot change the status bar background, but is there a way to change the status bar text color from black to white. I have a dark background canvas and the status bar disappears.

This has been discussed here : https://forum.xojo.com/18171-xojoioswrapper

Hi Michel,

I don’t see any mention of Status Bar in that post. I would not think changing the Status Bar text color from Black to white should be a big deal. It just seems like it should be a simple property change, but I can’t find anything about it anywhere.

[quote=224929:@James Redway]Hi Michel,

I don’t see any mention of Status Bar in that post. I would not think changing the Status Bar text color from Black to white should be a big deal. It just seems like it should be a simple property change, but I can’t find anything about it anywhere.[/quote]

Because what you call Status bar is I believe what Apple calls Navigation Bar, which is the zone at the top of the view. See https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Anatomy.html#//apple_ref/doc/uid/TP40006556-CH24-SW1

XojoiOSWrapper contains an example of setting the color of the Navigation bar. The link to download it is the first one of the thread I linked to.

Hi Michel,

The Status Bar and the Navigation Bar are two different things. If you look the Apple user manual you will see that Apple calls what I’m talking about a Status Bar. Its the little strip way at the top that displays, the Carrier WiFi, Date, and Battery Level.

link text

I don’t really want to add a wrapper to my project since I’m not sure if Apple will do something in the future to make the wrapper not work.

Changing the text color of the Status Bar should be a built-in property of Xojo iOS.

1 Like

[quote=224954:@James Redway]Hi Michel,

The Status Bar and the Navigation Bar are two different things. If you look the Apple user manual you will see that Apple calls what I’m talking about a Status Bar. Its the little strip way at the top that displays, the Carrier WiFi, Date, and Battery Level.

link text

I don’t really want to add a wrapper to my project since I’m not sure if Apple will do something in the future to make the wrapper not work.

Changing the text color of the Status Bar should be a built-in property of Xojo iOS.[/quote]

Not sure such a low level function should be a built-in property of Xojo. But you can always file a Feature request if you are serious about that.

As for using or not a wrapper, it is your privilege. Then you need to use a declare, adapting the techniques described here for instance :
http://stackoverflow.com/search?q=ios+change+status+bar+color

Pragmatism goes a long way to get things done IMHO.

Hi Jean-Paul and Michel,

Thank you for your help. I just thought this would be a basic property like changing a font color on a button. Didn’t think it was a big deal, but I guess it is. If you look at an iPad app like the Weather Channel app. You start it up and the background turns deep blue, and a second later the status bar text turns from black to white.

I’m not against wrappers, but I guess I get a little nervous that Apple will do something that might make the wrapper screw up.

Thanks again.

sounds like what the OP is looking for is implemented in SWIFT this way, by overriding this function of UIViewController

  override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return UIStatusBarStyle.LightContent // for white, use .Default for black
    }

if I may risk a comparison, the status bar is just an integral part of the system as much as the menu bar on a Mac or the task bar on Windows. It is NOT a part of your app. I do not think you can expect to change its color as you do a button anytime soon.

How many hundreds of thousands dollars does the Weather Channel have to produce an app ? They can do pretty much anything, with a team of dozens of engineers…

XojoiOSWrapper is basically a module, with independent methods you can pick an chose, copy separately. The engine behind the color change is just a declare, based on Apple documentation. Now, all declares, especially with Apple, can be broken at any time by some change in the framework.

Now, why use a declare that can be broken ? Because you want to do something that Xojo cannot. Incidentally if you were developing in XCode, calls to the framework would be broken just the same.

If you want to be safe from any framework deprecation, then you cannot access certain features.

[quote=225093:@Dave S]sounds like what the OP is looking for is implemented in SWIFT this way, by overriding this function of UIViewController

override func preferredStatusBarStyle() -> UIStatusBarStyle { return UIStatusBarStyle.LightContent // for white, use .Default for black } [/quote]

Culturally interesting to see how it is done in Swift. What would really be great for the OP is a declare in Xojo …

While I use XOJO Desktop quite a lot… I still cannot believe that Xojo for iOS is so immature, and yet they are asking a premium price.
And yes, there are “some” things that can be done easily, but it seems that many things that should be simple (such as this) require “declares” to implement. My opinion, is Declares should be the exception, not the rule. XOJO should be giving this level of “Xojo for iOS” away for free to get customers, until such time as it meets or exceeds the level of functionality in the desktop version, otherwise they are (again my opinion) attempting to compete against two very powerful iOS tools, both of which are free, and one of which is well established. Granted ObjC has a large learning curve. but Swift has a much shorter curve and is just as powerful.

Now I may get flamed for having these opinions, but I state them mostly because I was very disappointed with the iOS version finally came out amid all the hype, and left a lot (my opinion) to done before it was “usable”…

1 Like

Maybe you are missing the point because you have been through the admittedly steep learning curve of XCode, and because you are a competent programmer.

Xojo iOS is a decent version for relatively simple UIs. I would not call it immature, as it is very stable and works well. I could say “can do better” in terms of available controls, and do hope now that 64 bit is mostly out of the way Xojo will come back to it and add things like scrolling views, multicolumn tables and other stuff currently provided by third party developers such as Jean-Paul Devulder, Jason King and Ulrich Bogun. Already 2015R3 ads much needed Container Controls.

I sincerely think Xojo iOS should not be some kind of XCode like cornucopia of framework calls kind of paradox of choice incarnate. On the contrary, what makes Xojo great is the high level of abstraction that allows anybody to develop apps with little concern for under the hood dirt and grease.

Now, just as in the case of the OP, such ease of use gives the impression that anything should be simple, and that all whims should be satisfied. Hence “I want to do that, it should be as simple as setting the color of a button”. No, it is not. It is involved. Not much, mind you. Just as much as it is in Swift or Objective-C. It does not take rocket science to build a declare to do just the same as your swift snippet. It may even look similar. But just the same as a system call in Swift, it requires LEARNING, READING, EXPERIMENTING, DEBUGGING. Which used to be the daily lot of programmers before RAD came along.

Worse yet, Apple’s documentation nicely gives snippets in Swift and Objective-C, but no declare for Xojo. So it takes learning one of those two languages and having a more than adequate knowledge of declares to apply what is no more than copy/paste in XCode.

It is a fact of life : beyond “hello world”, one has to be prepared to learn, learn, learn. Takes a lot of patience and humility. One should not get the false impression that because he has mastered some kind of fluency in Xojo, he can climb Mount Everest in tongues or drive a Ferrari at the Monaco Grand Prix. Ambition is a good thing when one is prepared to work for it.

Michel… :slight_smile: I think you missed my point…

LC for SWIFT is NOT that steep

But at the moment that is EXACTLY what Xojo iOS is (declare=framework call), and Swift has little need for such, as they are part of the general lexical (this original topic being a prime example)

But why should they, they (Apple) has no vested interest in XOJO, quite the contrary

I agree 110%, and this applies to XOJO, ObjC, SWIFT, Pascal, Fortran,

I won’t hijack this thread any longer :slight_smile: