I have a requirement in which I have to use a UINavigationBar with a red big header.
I currently have the following code:
func prepareNavigationController() { let navController = UINavigationController(rootViewController: self) navController.navigationBar.prefersLargeTitles = true navigationItem.searchController = UISearchController(searchResultsController: nil) navigationItem.hidesSearchBarWhenScrolling = false navController.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.red] }
But this does not really tint the title bar in red. This is the result:

But changing prefersLargeTitles to false does the right thing, and my title is red.
navController.navigationBar.prefersLargeTitles = false

I’m not entirely sure that this is a mistake, because at the time of writing this article we are still in the first beta version, or if this is deliberate behavior, mainly due to the fact that I do not have any of the Apple applications. way to get a great headline for any color i want?
ios uikit ios11 uinavigationbar
Andy ibanez
source share