Remove Border of UISearchBar in iOS7 Remove Border of UISearchBar in iOS7 ios ios

Remove Border of UISearchBar in iOS7


Set Search Style = minimal in Search Bar properties in IB

Or

Swift:searchBar.searchBarStyle = UISearchBarStyleMinimal;Swift 3:searchBar.searchBarStyle = .minimal;


Setting searchBarStyle to UISearchBarStyleMinimal messed up my color setup, so doing this instead fixed the issue.

[self.searchField setBackgroundImage:[[UIImage alloc]init]];

For those looking for this option in Swift 4:

searchField.setBackgroundImage(UIImage(), for: .any, barMetrics: UIBarMetrics.default)


For Swift, these 2 lines are enough:

self.search.isTranslucent = falseself.search.backgroundImage = UIImage()

And then, apply required color that you want:

self.search.barTintColor = .red