Is there any way to change the text font and color of the UISearchBar Cancel button without subclassing the searchbar?
Is there any way to change the text font and color of the UISearchBar Cancel button without subclassing the searchbar?
Swift 5
let attributes:[NSAttributedString.Key: Any] = [
.foregroundColor: UIColor.black,
.font: UIFont.systemFont(ofSize: 17)
]
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attributes, for: .normal)