问题
I try to change the color from a UIPopoverControler on iOS 5. To do so, I use a subclass of UIPopoverBackgroundView that I assign to my popover like this:
self.popover.popoverBackgroundViewClass = [KWPopoverBackgroundView class];
My popover is now black as I defined in my KWPopoverBackgroundView class but I still have a problem with the appearance. The back button (Medals) of the navigationController inside my popover is still blue. I want everything unified in black. How do I get rid of this blue color?
I tried to change the tintColor of my navigationController.navigationBar but of course the popover does'nt care about that. Is there a way to fix this in iOS 5.0 ? (My app is on the AppStore, I don't want a ugly hack to fix this) Thank you.
回答1:
Ok, I just found how to change the tint color from the UINavigationController back button (or other UIBarButtonItems) inside the UIPopoverController.
With UIPopoverBackgroundView you can only change background and arrow images. To change the other items appearance you have to use UIAppearance with something like the following.
// Set the UIBarButtonItem(s) inside UIPopoverController class to dark gray
[[UIBarButtonItem appearanceWhenContainedIn:[UIPopoverController class], nil]
setTintColor:[UIColor colorWithWhite:0.1f alpha:1.0f]];
来源:https://stackoverflow.com/questions/11079148/change-uipopovercontroller-color-and-back-button-color