Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 SearchController Back Button Color

I have a strange visual bug in my app that only applies to iOS 13 running from an Xcode 11 build. I have a table view embedded in a Navigation Controller with the default tint color set to my app's primary orange color. On iOS12, when you cancel the search action, you are presented with a back button that follows the global nav controller tint of primary orange. This is the expected behavior. Image shown below:Orange Back Arrow in iOS12

However, this same code in iOS13 produces a system default BLUE back arrow, as shown below:

enter image description here

I have tried EVERYTHING to try and override that blue back button, including creating a custom Bar Button Item with a custom action, but that is way too messy and I want to just simply override the tint color. I've tried the obvious searchController.searchBar.tintColor = UIColor(named:"Primary") where searchController is my UISearchController, and I have tried to override the self.navigationController tint color. I've tried accessing the SearchBar natively, like this: UISearchBar.appearance().tintColor = UIColor(named:"Primary"), but still no luck. I've tried everything else I can think of in the IB, but I can not figure out how to reach this back button's tint color. Can anybody help?

like image 869
eResourcesInc Avatar asked Oct 14 '19 19:10

eResourcesInc


1 Answers

The only way I found so far to get this fix on iOS13.1 is to iterate through the subviews in the navigation bar and manually modified the tintColor.

None of the new UINavigationBarAppearance methods looks like they fix the problem. If you modified the backButtonAppearance in UINavigationBarAppearance I have been able to fix the title in back button but I haven't found a way to fix the image (<).

like image 103
agy Avatar answered Nov 16 '22 23:11

agy