Titanium Community Questions & Answer Archive

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

Hint: Hide Navbar when searching

Hi there,

Having been examining search for tableviews as it operates in default iphone apps I noticed that the convention is to hide the navbar to maximise the space available for search results.

One way of doing this in Titanium is to use 'hideNavBar' and 'showNavBar' functions. i.e:

searchBar.addEventListener('focus', function(e){
    Titanium.UI.currentWindow.hideNavBar();
});

searchBar.addEventListener('blur', function(e){
    Titanium.UI.currentWindow.showNavBar();
});

One of those little extras in pursuit of the truly native experience.

cheers,
Chris.

— asked May 9th 2010 by Chris Reed
  • iphone
  • navbar
  • search
0 Comments

4 Answers

  • Thanks! it worked perfectly, my app looks much nicer :)

    — answered May 19th 2012 by Joseph Rautenbach
    permalink
    0 Comments
  • Great tip, thanks :)

    Would be even nicer if the cancel button moves in on focus, and moves out on blur, just like in the Contacts app.

    — answered May 10th 2010 by Doney den Ouden
    permalink
    0 Comments
  • It does not seem to work (SDK 1.7.1). :(

    — answered June 30th 2011 by Kristof Gruber
    permalink
    0 Comments
  • Just add

    searchBar.showCancel = true or false

    as appropriate to get the cancel button to show up on focus and then to hide.

    — answered July 16th 2011 by Gerry High
    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.