I have changed the search bar placeholder color to blue and text color to white. Normal conditions works fine.
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setDefaultTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
[[UILabel appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor colorWithRed:131/255.0 green:169/255.0 blue:202/255.0 alpha:1.0] ];
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setBackgroundColor:[UIColor colorWithRed:42/255.0 green:93/255.0 blue:134/255.0 alpha:1.0]];
Issue When I set Text
self.searchbar.text = @"Some text";
The text displayed in search bar takes the placeholder color i.e blue but i want it to take white.