White line over UISearchDisplayController

I am having a problem with uisearchdisplaycontroller. If I add a controller search bar to the tableviews headerview, it will display a thin white line above the search bar! If I add a search bar without a searchcontroller, it will be displayed correctly. It is important to note that you are very careful about the searchdisplaycontroller standard or set it up a bit, otherwise you won’t be able to see the line.

Does anyone know how to avoid the white line?

Code in the init method 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];
    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 is related to the UISearchDisplayController and not the implementation, because if u uses only the search bar, everything is fine

+3
1

set searchBar.clipsToBounds = YES;

+4

All Articles