I am using the appearance api to customize UISearchBar
[[UISearchBar appearance] setSearchFieldBackgroundImage:searchBackground forState:UIControlStateNormal];
[[UISearchBar appearance] setBackgroundImage:backgroundImage];
[[UISearchBar appearance] setScopeBarBackgroundImage:backgroundImage];
[[UISearchBar appearance] setBackgroundColor:[UIColor clearColor]];
I am using this in a class that is a parent to other classes so that the effect is implemented on all child classes.
Now I need to customize one of the subclass containing UISearchBar
. I tried link
But I can't get that effect when the appearance is done on superclass. If I remove the appearance then I am able to have this effect.
How can I do this by implementing appearance api?
Based on the Apple's documentation
[[UISearchBar appearanceWhenContainedIn:[yourSubClassedViewControllerWhichHasSearchbar class], nil]
setBackgroundColor:[UIColor orangeColor]];