In my app I use a UITableView and a SearchBar, nothing special.
The SearchBar is added as tableHeaderView
self.searchDisplayController.searchBar.delegate = self;
self.myTableView.tableHeaderView = self.searchDisplayController.searchBar;
Than I use the following code to let the SearchBar stay on, so that it don’t gets hidden when scrolling.
- (void) scrollViewDidScroll:(UIScrollView *)scrollView {
CGRect tableBounds = self.myTableView.bounds;
CGRect searchBarFrame = self.searchDisplayController.searchBar.frame;
self.searchDisplayController.searchBar.frame = CGRectMake(tableBounds.origin.x, tableBounds.origin.y, searchBarFrame.size.width, searchBarFrame.size.height);
}
This works nice in iOS5 and iOS5.1 but not in iOS6 but I don’t know what has changed, does anyone have any ideas?
Help would be higgle appreciated.
SearchBar in iOS5 and iOS5.1

SearchBar in iOS6 is hidden

I’m not sure why it’s changed, but it’s fairly straightforward to get this working on iOS 6.
Instead of setting the
UISearchBaras thetableHeaderView, use a plainUIViewinstead, then add the search bar as a child of that view.