本文介绍了更改UIPopoverController颜色(和后退按钮颜色)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从iOS 5上的UIPopoverControler更改颜色。为此,我使用UIPopoverBackgroundView的子类,我将其分配给我的popover:

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];

我在我的KWPopoverBackgroundView类中定义的popover现在是黑色但我的外观仍然有问题。我的popover中的navigationController的后退按钮(Medals)仍为蓝色。我希望所有的东西都是黑色的。如何摆脱这种蓝色?

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?

我试图改变我的navigationController.navigationBar的tintColor,但当然popover不关心这个。
有没有办法在iOS 5.0中解决这个问题? (我的应用程序在AppStore上,我不想要一个丑陋的黑客来解决这个问题)谢谢。

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.

推荐答案

好的,我刚刚发现如何从UIPopoverController内的UINavigationController后退按钮(或其他UIBarButtonItems)更改色调颜色。

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

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

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]];

这篇关于更改UIPopoverController颜色(和后退按钮颜色)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 06:56