Titanium Community Questions & Answer Archive

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

Height of usable view on mobile device

I'm embarrassed that after searching a few (hours) I am unable to determine how many pixels are available for my use.

Lets say it's an iPhone with a 320x480 physical display.

example 1: I have a title bar and a tab group.

Every Height parameter I've checked reports a height of 460

Titanium.API.debug("Window Height: " + tab1.window.height);
Titanium.API.debug("Tab Group Height: " + tabGroup.view.height);
Titanium.API.debug("Tab View Height: " + tab1.view.height);

example 2: I remove the title bar and only have a tab group

Still, every Height parameter reports 460.

So my question is… how do I determine the height of the tab bar, title bar and client view area that I have remaining to provide UI content.

Thanks for any help
-Steve

— asked October 25th 2010 by Steven Day
  • android
  • iphone
  • mobile
0 Comments

2 Answers

  • Status Bar: 20px
    Navigation Bar: 44px
    Tab Bar: 50px

    — answered October 26th 2010 by Duncan Kabinu
    permalink
    2 Comments
    • Thanks for the info. I am hesitant to using hard coded values like that. Is there a way to determine this programmatically? I mean is it a guarantee that on all devices they are that size. If I switch from iPhone 3gs to iPhone 4 are those bars still the same # of pixels?

      thanks

      — commented October 26th 2010 by Steven Day
    • Use the 'density' property of the DisplayCaps object to determine if it's a retina display or not and then use that to determine the sizes compared to Duncan's values.

      hth.

      — commented October 26th 2010 by Kosso
  • Status Bar: 20px
    Navigation Bar: 44px
    Tab Bar: 50px

    — answered October 26th 2010 by Duncan Kabinu
    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.