After setting the tint of a UISearchBar
to White:
There is an extra black line between the search box and the table:
How can I remove the black line?
After setting the tint of a UISearchBar
to White:
There is an extra black line between the search box and the table:
How can I remove the black line?
Just a tweak...
searchBar.layer.borderWidth = 1;
searchBar.layer.borderColor = [[UIColor whiteColor] CGColor];
I realize Legolas answer is old - but I stumbled upon the same problem, and now it seems there instead of a borderColor is a special view acting as a shadow which creates this effect.
The only way of fixing this is to search for a view called "_UISearchBarShadowView" and hide it.
It is a subview of a subview of searchDisplayController.searchResultsTableView and only exists after typing a character into the search bar. I fixed the problem with the code below.
(getSubviewByClass is a category of UIView I created to loop through views and find subviews by a string)
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
[self performSelector:@selector(searchResultsTableShouldChange) withObject:nil afterDelay:0.0001];
}
- (void)searchResultsTableShouldChange {
[[self.view getSubviewByClass:@"_UISearchBarShadowView"] setHidden:YES];
}
searchBar.backgroundImage = [UIImage new];
See the explanation from 'theMonster' here: https://stackoverflow.com/a/25275021/1751266