I have a UIWebView in my app, and the problem is that I have a UIAppearance that modifies the appearance of segmented controls, so it modifies the segmented control in the input accessory view for UIWebView textfields, I'd like for it to look properly, or to not attempt to modify it. This is what it currently looks like:
I just solved this problem for myself by using [UIAppearance appearanceWhenContainedIn:] instead of [UIAppearance appearance].
Use it by sending the selector a nil-terminated list of all your custom ViewController classes that contain the elements you want to customize. So instead of
[[UISegmentedControl appearance] setBackgroundImage:buttonBackgroundImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
use
[[UISegmentedControl appearanceWhenContainedIn:[MyViewController class], [MyOtherViewController class], nil] setBackgroundImage:buttonBackgroundImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
You don't need to list all the ViewControllers, just your top-level ones. This also makes the following trick possible: Create an 'empty' subclass CustomizedViewController of UIViewController that does nothing else than being a subclass - and then subclass from there throughout your code instead from UIViewController (basically replace all occurences of 'UIViewController' with 'CustomizedViewController' - except where CustomizedViewController actually declared UIViewController as its superclass.
Then use
[[UISegmentedControl appearanceWhenContainedIn:[CustomizedViewController class], nil] setBackgroundImage:buttonBackgroundImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];