White line above UISearchDisplayController
I got a problem with the uisearchdisplaycontroller. If I add the controller's searchbar to a tableviews headerview it shows a thin white line above the searchbar! If I add the searchbar without the searchcontroller it shows it correctly. Important is that u take a really close look to the standard searchdisplaycontroller or customize it a bit, otherwise you will not be able to see the line.
Does anyone knows a way to avoid the white line?
Code in init methode of BaseViewController : UIViewController
searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
[searchBar sizeToFit];
searchBar.showsCancelButton = NO;
searchBar.barStyle = UIBarStyleDefault;
searchBar.hidden = NO;
searchBar.delegate = self;
searchBar.placeholder = @"Suche";
searchCtrl = [[UISearchDisplayController alloc]
initWithSearchBar:searchBar contentsController:self开发者_JS百科];
searchCtrl.delegate = self;
searchCtrl.searchResultsDataSource = self;
searchCtrl.searchResultsDelegate = self;
[searchCtrl searchResultsTableView].scrollsToTop = NO;
Code in StartViewController : BaseViewController in viewWillAppear
tableController.tableView.tableHeaderView = searchCtrl.searchBar;
searchBar.hidden = NO;
if ( [tableController.tableView contentOffset].y == 0.0 )
{
[tableController.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];
}
Nothing special, for me it has to do with the UISearchDisplayController not with the implementation, cause if u only use the searchbar everything is fine
set searchBar.clipsToBounds = YES;
精彩评论