改变UIPopoverController颜色(和后退按钮颜色)

时间:2022-11-20 14:03:21

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:

我尝试改变ios5上UIPopoverControler的颜色。为此,我使用了UIPopoverBackgroundView的一个子类,我将它分配给我的弹出窗口如下所示:

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?

我的弹窗现在是黑色的,正如我在我的KWPopoverBackgroundView类中定义的,但是我的外观仍然有问题。我弹窗内导航控制器的后退按钮(奖章)仍然是蓝色的。我要一切都统一成黑色。怎么去掉这个蓝色呢?

改变UIPopoverController颜色(和后退按钮颜色)

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.

我试图改变导航控制器的颜色。导航条,但是弹窗当然不在乎这个。在iOS 5.0中有办法解决这个问题吗?(我的应用程序在AppStore上,我不想要一个丑陋的黑客来修复这个)谢谢。

1 个解决方案

#1


12  

Ok, I just found how to change the tint color from the UINavigationController back button (or other UIBarButtonItems) inside the UIPopoverController.

我刚刚找到了如何从UIPopoverController内的UINavigationController后退按钮(或其他UIBarButtonItems)改变颜色。

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.

使用UIPopoverBackgroundView你只能改变背景和箭头图像。要更改其他项目的外观,您必须使用UIAppearance,如下所示。

// Set the UIBarButtonItem(s) inside UIPopoverController class to dark gray
[[UIBarButtonItem appearanceWhenContainedIn:[UIPopoverController class], nil] 
                        setTintColor:[UIColor colorWithWhite:0.1f alpha:1.0f]];

改变UIPopoverController颜色(和后退按钮颜色)

#1


12  

Ok, I just found how to change the tint color from the UINavigationController back button (or other UIBarButtonItems) inside the UIPopoverController.

我刚刚找到了如何从UIPopoverController内的UINavigationController后退按钮(或其他UIBarButtonItems)改变颜色。

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.

使用UIPopoverBackgroundView你只能改变背景和箭头图像。要更改其他项目的外观,您必须使用UIAppearance,如下所示。

// Set the UIBarButtonItem(s) inside UIPopoverController class to dark gray
[[UIBarButtonItem appearanceWhenContainedIn:[UIPopoverController class], nil] 
                        setTintColor:[UIColor colorWithWhite:0.1f alpha:1.0f]];

改变UIPopoverController颜色(和后退按钮颜色)