When I added a UISearchBar to UITableView.tableHeaderView, it shows a border

With shadow

With shadow zoom

So in order to remove the 1px, just

1
2
self.searchBar.layer.borderColor = [UIColor yourColor].CGColor;
self.searchBar.layer.borderWidth = 1;

The final result will be

Without shadow

Without shadow zoom

References: