I am working on a page which contains searchBar. So I used UISearchController
for it.
In app delegate we have changed the appearance of UISearchBar
by adding image to the background.
UISearchBar.appearance().setBackgroundImage(UIImage(named: "search-bg"), for: UIBarPosition.any, barMetrics: UIBarMetrics.default)
Now when I am using the searchController in a viewcontroller, on tapping searchBar there seems to be a black curtain view on the searchBar:
When I removed the UISearchBar.appearance().setBackgroundImage
, searchBar seems to look fine. But I need that change in searchBar, so I tried changing the background image by setting:
self.searchBar.backgroundImage = UIImage.init()
But this too does not work.
Is there a way to undo the setBackground Image for one viewcontroller? Or any other way to achieve this?