UISearchBar over UINavigationBar with custom background color
UISearchBar over UINavigationBar with custom background color
- Subject: UISearchBar over UINavigationBar with custom background color
- From: Rick Mann <email@hidden>
- Date: Mon, 02 Nov 2015 18:56:20 -0800
I'm using a UISearchController with the presenting VC as the results controller. I want to display the search bar (field and cancel button) over my UINavigationBar. I want the background color of the search bar to be the same as my navigation bar (0, 47, 64, 1.0). But when I try to set its barTintColor, I get (0, 248, 248), a gaudy bright blue. I'm creating it with this:
self.searchController = UISearchController(searchResultsController: nil)
self.searchController!.searchResultsUpdater = self
self.searchController!.searchBar.delegate = self
self.searchController!.hidesNavigationBarDuringPresentation = false
self.searchController!.dimsBackgroundDuringPresentation = false
self.searchController!.searchBar.barTintColor = UIColor(colorLiteralRed: 0, green: 47, blue: 64, alpha: 1.0)
I've tried a number of variations, short of generating a UIImage filled with that color to set as the background image.
Any ideas? Thanks.
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden