Reputation: 331
I'm using iOS 14 SDK for development and I want to add a custom button between UISearchBar and the Cancel button when the search is enabled.
I have checked all attributes in UISearchController and UISearchBar level, but I couldn't find any attribute for doing it. :(
I saw a similar kind of button in the default iOS Files app, I have attached the screenshot and marked it with a red color box. Can someone give a clue for doing that? I really appreciate your help.
Upvotes: 3
Views: 908
Reputation: 5287
You can try this:
if searchController.isActive {
searchController.searchBar.showsBookmarkButton = true
} else {
searchController.searchBar.showsBookmarkButton = false
}
searchController.searchBar.setImage(UIImage(named: "imgName"), for: .bookmark, state: .normal)
Upvotes: 1