Marvel Gerrard
Marvel Gerrard

Reputation: 89

Status bar in titanium

The new iOS 7 is quite tricky. I am having issues with the status bar color in my titanium iOS 7 simulator. I asked the question On titanium but the answer i got dint resolve the issue, i would want to change the status bar color to black.

Upvotes: 3

Views: 5364

Answers (3)

Shima
Shima

Reputation: 33

Just need to give your window's backgroundColor to black.

If you want to give some other color, and the labels to be white in color:

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>

in xml,

<Window id="contactScreen" backgroundColor="yourColor">
</Window>

Upvotes: 0

ardylles
ardylles

Reputation: 1

<Window statusBarStyle="Ti.UI.iPhone.StatusBar.OPAQUE_BLACK" backgroundColor="#000">

gives me a nice black status bar with white text

Upvotes: 0

mwfire
mwfire

Reputation: 1667

I do not know what the suggestion at the dev forum was, but this should do the trick:

var win = Ti.UI.createWindow({
    ...
    statusBarStyle: Ti.UI.iPhone.StatusBar.OPAQUE_BLACK
});
win.open();


Make sure to

  • set the statusBarStyle before opening the window, setting it afterwards is not supported in iOS7
  • set the Titanium SDK to 3.1.3 GA in tiapp.xml, as this is a new feature.

You can find the available statusBarStyles in the docs.
Moreover, this link might shed some light on the changes in iOS7 and Titanium 3.1.3 SDK.


Note
This does not add a background color anymore, but only changes the text color. A workaround would be to add a 20px view to the top:

var fakeStatusBar = Ti.UI.createView({
    left            : 0,
    top             : 0,
    height          : 20,
    width           : Ti.UI.FILL,
    backgroundColor : '#000'
});
win.add(fakeStatusBar);

Upvotes: 6

Related Questions