I try to set the bar color of a UISearchbar to one color and the tintColor (cursor and Cancel-Button) to another color with code like this:
searchbar.barTintColor = color1;
searchbar.tintColor = color2;
The barTintColor is applied correctly.
The problem is: The text of the cancel button is not visible but if try the same in storyboard (apply batTintColor and tintColor to a UISearchbar) everything works as expected.
I noticed that the cancel button is only not visible when it's state is "normal" so I found this code which solve the problem but I don't think this is the intended approach.
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor greenColor]} forState:UIControlStateNormal];