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.
4 Answers
-
Thanks! it worked perfectly, my app looks much nicer :)
-
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.
-
It does not seem to work (SDK 1.7.1). :(
-
Just add
searchBar.showCancel = true or false
as appropriate to get the cancel button to show up on focus and then to hide.