Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Status Bar Style and 1.4

Ever since running in 1.4 appcelerator won't accept setting the iphone status bar in my app. Yet I see it working in kitchensink. I used to just set it in tiapp.xml and leave it. Now it does not respect it so I tried setting it in app.js with Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.OPAQUE_BLACK; but that does not work either. Any ideas or has anyone found similar?

— asked August 11th 2010 by Kevin Ripka
  • bar
  • iphone
  • status
1 Comment
  • I am having an even stranger issue. When I paste Tamas' code into my app and run it, I get the big RED screen and it says "Result of expression 'Titanium.UI.iPhone.StatusBar' [undefined] is not an object. at app.js (line 1)" ??? I am running on SDK 1.4.1, did you have this issue also?

    — commented August 12th 2010 by Ben Hornedo

9 Answers

  • in your tiapp.xml change this:

    <statusbar-style>default</statusbar-style>

    to this:

    <statusbar-style>opaque</statusbar-style>

    and you'll get the black statusbar. I can't believe how long it took me to find this. I hope it helps someone else. Appcelerator should really post this somewhere.

    — answered November 11th 2010 by Glen McPherson
    permalink
    2 Comments
    • doesn't work in iOS7

      — commented June 19th 2013 by Leon Truong
    • BTW, This works for iOS 7:

      Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.TRANSLUCENT_BLACK;
      

      thanks Gaurav Agrawal

      — commented June 19th 2013 by Leon Truong
  • Gentlemen,

    The Only way the Status Bar can set the Color to say: translucent_black is if you set the barColor.

    Example… to have a StatusBar color the same (or translucent) to the barColor:

    // in tiapp.xml
    <statusbar-style>translucent_black</statusbar-style>
    
    // in YourWindow.js
    var self = Ti.UI.createWindow({
            barColor:'#99cc66', // a must
    })
    
    — answered April 28th 2013 by Joseph Sachs
    permalink
    0 Comments
  • I created a new project and put the line you wrote here as the first line in app.js. With copy/paste.

    
    // this sets the background color of the master UIView (when there are no windows/tab groups on it)
    
    
    Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.OPAQUE_BLACK;
    
    Titanium.UI.setBackgroundColor('#000');
    
    // create tab group
    

    Compiled with the last 1.4.1 it worked

    Compiled with 1.4.0 it worked

    I use the stock tiapp.xml

    Maybe you make something along.

    Give us some code.

    — answered August 11th 2010 by Dan Tamas
    permalink
    0 Comments
  • I know that I use this code on every page of my app:

    win.barImage = &#39;..&#x2F;images&#x2F;header.jpg&#39;;

    However, you can see a glitch - everytime you reload the app then go to a new screen, you can see the default status bar for a split-second, then the custom status bar kicks in. Kinda annoying.

    — answered November 23rd 2010 by Erick Arbe
    permalink
    1 Comment
    • I'm using SDK 1.4.3 and most of the time you go to a new screen, the status bar goes back to default, is there a way to fix this?
      Like setting a default image?

      — commented December 4th 2010 by Wouter De Loose
  • you just paste these code in app.js and see your app

    Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.TRANSLUCENT_BLACK;
    

    and its working. your statusbar colour will be black.

    — answered June 25th 2011 by Gaurav Agrawal
    permalink
    1 Comment
    • Works nicely. Also fix the tab bar issue in IO7 looks like

      — commented June 19th 2013 by Leon Truong
  • Seriously, can someone at least check in and say whether they are having problems with status bar styling? Why would it work in my app in 1.2 and 1.3 and not in 1.4 when I didn't change any code? I've tried on two different computers with installs of 4.0.1 and 1.4, created new projects, thrown away my app build to force a clean one and still can't get it to work from anywhere but kitchensink using the same exact code cut and pasted.

    — answered August 11th 2010 by Kevin Ripka
    permalink
    0 Comments
  • Thanks Tamas, I cut and pasted what you wrote (which is what you copy and pasted that I wrote) and it magically worked. Makes no sense. Maybe an invisible character? Maybe all my bugs I need to cut and paste to you!

    — answered August 11th 2010 by Kevin Ripka
    permalink
    0 Comments
  • I can get the statusbar to opaque_black within my application, but it isn't black at the startscreen.

    I have this line in my app.js on the first line.
    Titanium.UI.iPhone.setStatusBarStyle(Titanium.UI.iPhone.StatusBar.OPAQUE_BLACK);

    and in tiapp.xml I've changed from default to opaque_black here:
    <statusbar-style>opaque_black</statusbar-style>

    But it's still default/gray when the application is starting/loading and then it changes to black.

    Is it possible to fix this somehow?

    — answered October 28th 2010 by Ted Sundin
    permalink
    0 Comments
  • I had the same problem- used <statusbar-style>opaque_black</statusbar-style> in tiapp.xml - no changed.

    It is simple to fix:
    Just remove the build folder and force it to recompile the project completely. Worked fine for me.

    — answered May 16th 2011 by Stefan Elsner
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.