Monday, January 10, 2011

Window Backgrounds

Design is a clearly an important element for all apps. You have such a limited space (on the iPhone - Width: 320, Height: 480 pixels) that you have to make good use of the space.  One way to do this is use beautiful window backgrounds to spice up your app.

Given the following directory structure of your projects with the winBackground.png in the Resources/Images folder:




Setting the background of a window is pretty straightforward:


var shuffleWindow = Titanium.UI.createWindow({
    title:'Shuffle',
    backgroundImage:'images/winBackground.png'
});



I had some trouble getting the right image to load. I've seen instructions for the backgroundImage: '../images/winBackground.png' or '/images/winBackground.png' and was rather confused.  If you see a black background it probably means the path to the image is wrong.

No comments:

Post a Comment