UISearchBar on the top of UITableView which can hide but stay close to UINavigationBar

I would like to have a UISearchBar on the top of my UITableView which hides when you scroll down: The answer is easy, I just need to add it on my table view header like this:

UISearchBar *search = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 45)];
self.tableView.tableHeaderView = search;
[search release];

But the problem is that when you scroll up the UISearchBar fit to the top of the UITableView, and not the top of the UINavigationBar. To be more clear I made a screen in Mail (not good) and Game Center (good).

enter image description here

I want the same as in Game Center. Do you have any idea how they are doing this ?

13
задан Ludovic Landry 10 February 2011 в 10:32
поделиться