I am trying to change the background color of a UISearchBar input field. In the rounded form, where you enter the text to search for, the default color is white. I would like to change it to gray
I tried:
for (UIView *subView in searchBar.subviews) { if ([subView isKindOfClass:NSClassFromString(@"UITextField")]) { UITextField *textField = (UITextField *)subView; [textField setBackgroundColor:[UIColor grayColor]]; }
But this does not work :(
I also tried pasting the image into a TextField, but it looks like the rounded view is separate from the TextField. So, any clues?
ios objective-c iphone uisearchbar
muc Aug 29 2018-11-11T00: 00Z
source share