更改 UIPopoverController 颜色(和后退按钮颜色) [英] Change UIPopoverController color (and back button color)

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

问题描述

我尝试从 iOS 5 上的 UIPopoverControler 更改颜色.为此,我使用了 UIPopoverBackgroundView 的子类,我将其分配给我的弹出框,如下所示:

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 类中定义的那样,但我的外观仍然存在问题.我的弹出框内的导航控制器的后退按钮(奖牌)仍然是蓝色的.我希望一切都统一为黑色.如何摆脱这种蓝色?

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 颜色(和后退按钮颜色)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆