When customizing the appearance of UIButton using the class proxy UIBarItems seem to initially take on the custom properties set for UIButton.
Starting with the default Master/Detail project using Core Data. Customize the appearance of UIButton in the AppDelegate and run the app. Click the Edit button, then the Done button in the navigation bar for the MasterViewController and watch the customization go away.
Custom appearance code in [AppDelegate application:didFinishLaunchingWithOptions]:
UIImage *customBackground = [[UIImage imageNamed:@"yourcustomimage.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5,5,5,5)];
[[UIButton appearance] setBackgroundImage:customBackground forState:UIControlStateNormal];
All UIBarButtonItems initialize with custom background
When the Edit button is replaced by the Done button, it correctly does not have the customized background.
A similar question asks how to customize the Done button. I'm concerned why this is happening at all to UIBarItem objects, which do not inherit from UIButton, and would like to know how to correct it.
I suspect the proxy inheritance and the supported properties, but I don't know how to correct for it. Any suggestions?
My suggestion would be to reset
backgroundImage
tonil
when contained inUINavigationBar
: