Hi, I have a question, I don't know if is a stupid question but I don't find a solution.
I created a window with a background image (320 x 480) and I added a tab group.
The tab group don't stay in front the background of the window but the background height is deformed.
I've tried to set z-index to window (0) and tab group (100) but doesn't work.
How I can maintain the background at 100% of height? Thank you
Application type: mobile Platform & version: iOS Device: iOS simulator, Host Operating System: OSX
2 Answers
Accepted Answer
Hi Luca
If you could provide an example of your code (simplified if possible) to demonstrate what you mean, that way people can run the code, see the issue and report back to you.
I am not sure if you are saying you have created BOTH a window containing a background image AND a tab group which would also contain at least one window per tab. If this is the case then be aware that the Tab group should be added to the context first and windows that are not part of the tab group should be opened over the top of the tab group.
However your background image problem is actually a simple one - once explained. When you add a background image to a window the space it has available to display in is determined by the internally available space. In the case of an app with the top status bar, title/nav bar and tab bar the remaining space is 320x367. As the background image so the image will be shrunk to fit. The same thing will occur if you add an image view to the window.
You can however add a standard view to the window and then add an image view to this standard view, that way the image maintains its size and will (in this example) position itself to the top of the available space and the remainder will be clipped below. You could of course adjust the top parameter entry to a negative -64 which will visually place the background image at the top of the phone.
var viewBack = Ti.UI.createView({ height: Ti.UI.SIZE, top: 0, width: Ti.UI.SIZE }); win.add(viewBack); var imgBack = Ti.UI.createImageView({ image: 'background.png', height: 480, top: 0, width: 320 }); viewBack.add(imgBack);
Thank you very much for your help, it's working with your code!
But if I set height:480 and width:320 (resolution iPhone 3) then i use @2 for iPhone 4 images, how width and height values changes? It's work automatically or i must use a condition?
Thank you
Your Answer
Think you can help? Login to answer this question!