Titanium Community Questions & Answer Archive

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

Setting a main background image for an iPhone App

I would like to set a main background image for my entire application.

Is there a property where I can set this?

Right now, I'm setting it for each specific window, and when I transition from one window to the next - it slides.

— asked March 31st 2010 by Marshall Jones
  • backgroundimage
  • iphone
0 Comments

2 Answers

  • Accepted Answer

    Hi Marshall,

    In my app.js I have,

    Titanium.UI.setBackgroundColor('#000');
    Titanium.UI.setBackgroundImage('graphics/bg.png');
    

    In my current app I have a TabGroup with a single Tab to load the Windows so I get the NavBar and slide animation but I think it would work if your app was structured as just a series of windows you self manage.

    You don't need to specify anything at Window creation to keep the transparency of the window.

    While its not required I included the first line in the above code because you can also use the alpha of the PNG if you wanted to mix things up a bit. As a test change #000 to #0f0 and place an image with alpa in to see the background color (ps. I don't recommend using #0f0 for a production release).

    Cheers,
    Shane…

    — answered March 31st 2010 by Shane Maiolo
    permalink
    0 Comments
  • Choose a background image for each Window in app.js

    and

    any other new window, set background color to 'transparent'.

    — answered April 1st 2010 by Peter Lum
    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.