I have an app that places a UISearchBar into a UINavigationBar. In iOS 10.x and earlier, the search bar's corners blended in with the underlying navigation bar, but in the latest iOS 11 developer beta, the corners have turned a light grey color for some reason. How do I get the iOS 10 behavior back? I've searched the forums and the documentation, and haven't been able to get any answers.
Grey background in UISearchBar?
Setting `searchBar.backgroundImage = UIImage()` fixes the issue.
Hi Colok!
Were you able to set the background image to UISearchBar in iOS 11?
I tried to set the background image, and nothing works for me. I tried those threee following ways :
UISearchBar.appearance().setBackgroundImage( imageLiteral(resourceName: "navigationBarImage"), for: .any, barMetrics: UIBarMetrics.default) searchController.searchBar.backgroundImage = imageLiteral(resourceName: "navigationBarImage") searchController.searchBar.setBackgroundImage( imageLiteral(resourceName: "navigationBarImage"), for: .any, barMetrics: UIBarMetrics.default)
None of them worked. The UISearchBar gets the color of the navigation bar tint color, but images are completely ignored.