Skip to content

Instantly share code, notes, and snippets.

@JulienKode
Created January 8, 2019 15:24
Show Gist options
  • Save JulienKode/52918fc189d94e24e6a1059de767e598 to your computer and use it in GitHub Desktop.
Save JulienKode/52918fc189d94e24e6a1059de767e598 to your computer and use it in GitHub Desktop.
How to change the cancel button color of the search bar ?
let cancelButtonAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(cancelButtonAttributes, for: .normal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment