views:

443

answers:

1

In OS3.0 a lot of plain table views have an initially hidden search bar that can be accessed by scrolling down to reveal it (e.g. mail, ipod).

Is it possible to do the same thing for a grouped table view?

Background:

I'm using a grouped table view as a static navigation menu (similar to the Things app). The content never changes, it's just a way to choose which view to push next. Above the table view, I have a search bar. I'd like that search bar to be hidden initially, as it doesn't look good and may also be confusing for new users - also because that seems to be the standard now.

Note, the search bar has nothing to do with the datasource of the table view it's in - it's not searching the contents of that table view. It's a search on a remote server. The results are displayed in a new view which is pushed on the stack. The search bar is intended to be just a quick way to get at that functionality.

+2  A: 

UITableView inherits from UIScrollView, so set the bounds of the UITableView to move the search bar out of view when the UITableView is about to start displaying.

Nathan de Vries
the problem is the searchbar is not in the tableview but above it as a sibling. if I put it in the table view, e.g. as a custom cell, then it looks wrong as the grouped cells do not span the width of the view.
frankodwyer
ah, this works if I stick the searchbar into the tableview in IB. +1. cheers
frankodwyer
Yep, UITableView has a header (tableHeaderView) and footer (tableFooterView) view which can be used without using custom cells in the table itself. I don't use IB, but I suspect it's done that work for you.
Nathan de Vries