Xcode 11 Beta 6 UISearchBar textfield background/tintcolor color

Any idea how to set the UISearchBar textfield's background color separately from the search bar's tintcolor?


[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[XYNavigationController class]]].barTintColor = [UIColor redColor];


results in

https://postimg.cc/yJnmHdq2


And even if you try:

[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class], [XYNavigationController class], [UINavigationBar class]]].layer.backgroundColor = [UIColor orangeColor].CGColor;


[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class], [XYNavigationController class], [UINavigationBar class]]].backgroundColor = [UIColor orangeColor];


[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class], [XYNavigationController class], [UINavigationBar class]]].tintColor = [UIColor orangeColor];


the textfield's background color won't change to orange.

Is this a bug or something different needs to be done?


Thanks.

For changing searchBar's text field background color, use UISearchBar.searchTextField.backgroundColor property added in iOS 13.


I am also facing some similar issue.

I am not able to change searchBar's placeholder text color.

It is stuck with default grey.

I am using an NSAttributedString(string: searchMessage, attributes: attributes)

where attributes = [NSAttributedStringKey.foregroundColor: UIColor.white] and setting it to searchBar's attributedPlaceholder property.

Xcode 11 Beta 6 UISearchBar textfield background/tintcolor color
 
 
Q