Change UIPopoverController color (and back button color)

久未见 提交于 2019-12-19 03:14:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!