In iOS 7.x we were able to use
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil]
setDefaultTextAttributes:@{NSForegroundColorAttributeName:myColor}];
But it is deprecated in iOS 9. The only solution I know is to iterate through the subview hierarchy UISearchBar
, find UITextField
and change its properties. But this method is considered as Private use of API
Do I have a legal way to change the text color of a UISearchBar in iOS 9.x?
source
share