Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing the searchbar only when user pull down the table

I have a table view with a search bar on top of it. My requirement is to do not show the search bar when someone open the page but when someone slides the table down then the search bar should be visible.

like image 446
Abhinav Avatar asked Sep 30 '11 20:09

Abhinav


1 Answers

In your controller's viewDidAppear: method, set the contentOffset property (in UIScrollView) of your table view to hide the search bar.

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];    
    self.tableView.contentOffset = CGPointMake(0, SEARCH_BAR_HEIGHT);
}
like image 88
murat Avatar answered Sep 21 '22 15:09

murat