Remove the 1px border under UISearchBar Remove the 1px border under UISearchBar xcode xcode

Remove the 1px border under UISearchBar


Nevermind, I just did:

searchBar.layer.borderWidth = 1;searchBar.layer.borderColor = [[UIColor whiteColor] CGColor];

and it works!


[searchBar setBackgroundImage:[UIImage new]];


For Swift version, tested on iOS9:

searchBar.backgroundImage = UIImage() 

It would show like this:

no-border-result