Background image resize when navbar is visible

You must Login before you can answer or comment on any questions.

Hi.

How do i make my background image to fill the width 100% when i have

win.showNavBar();
When i try
win.hideNavBar();
it fills fine. But now i got like 10dp on both sides left.

What to do?

Thanx

//R

1 Answer

Accepted Answer

Not being 100% sure what you're dealing with... I think you might need to go over the dimension (sizes) of the UI elements you have on the window.

Just for reference purposes, let me jot down iPhone's default (non-retina) UI element sizes.

  • Status Bar : 320px * 20px (portrait mode)
  • Navigation Bar : 320px * 44px (portrait mode)
  • Tab Bar Height : 49px

And the above dimension would leave you with a 320px * 367px sized window to work with.

Jae

— answered 12 months ago by Jae Lee
answer permalink
3 Comments
  • Yes i got that but this is how it plays out.

    When i have the navbar: http://lucyseven.com/bar.png

    And without: http://lucyseven.com/nobar.png

    This is the code i use for the background

    var win = Ti.UI.currentWindow;
     
    win.hideNavBar();
     
     
     
    var bgImage = Ti.UI.createImageView({
        height  : 'auto',
        top     : -11,
        image   : 'images/h-5.jpg',
        zIndex  : 0
    });
    win.add(bgImage);
    Thanx

    //R

    — commented 12 months ago by Richard Harrysson

  • Ok...I got it now...

    Of course it would be strange when the height was off.

    Sorry. and thanx.

    — commented 12 months ago by Richard Harrysson

  • No worries - and good to see that you've figured it out.

    Cheers.

    — commented 12 months ago by Jae Lee

Your Answer

Think you can help? Login to answer this question!