I have added a UISearchBar
to the top of my PFQueryTableViewController
. I have changed the colour of the searchBar to be the colour of my app, but
Base on Nick89's code , I changed like that for Swift 3.1
let cancelButtonAttributes: [String: AnyObject] = [NSForegroundColorAttributeName: UIColor.white]
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(cancelButtonAttributes, for: .normal)
I want to change on UISearchBar
only instead of all UIBarButton, so I'm using like UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self])