真的奇怪的应用程序颜色行为? [英] REALLY strange app color behavior?

查看:203
本文介绍了真的奇怪的应用程序颜色行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在appDidFinishLaunchingWithOptions上,我使用以下代码将我的整个应用程序调为红色。

On appDidFinishLaunchingWithOptions, I tint my entire app red with the following code.

self.window.tintColor = [UIColor otfRedColor];

这完美地工作,当我的应用程序加载时,所有导航栏项目都是红色的。 A是我的根视图控制器。

This works perfectly, and when my app loads, all the navigation bar items are red. A is my root view controller.

我有3个视图控制器,a,b和c。 A拉起b的模式表示视图表,拉出c的完整模态视图。当C被拉起,导航栏上的条形按钮项目都是灰色的,这不应该发生,因为我没有任何方式改变任何方式,在应用程序代理设色窗口后的任何颜色。然后使用

I have 3 view controllers, a, b, and c. A pulls up a modal presentation view sheet of b which pulls up a full modal view of c. When C is pulled up, the bar button items on navigation bar are all tinted gray, this shouldn't be happening because I didn't alter any tint or color in any way after the app delegate tinted the window. I then use

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];

来关闭VC c和b,但现在我的ENTIRE应用程序是灰色的。自从应用程序委托后,我没有使用任何色调代码,为什么会发生?当我再次从A到B时,导航栏项目仍然是红色的

to dismiss VC c and b, but now my ENTIRE app is tinted gray. I haven't used any tint code at all since the app delegate, why does this happen? When I go from A to B again, that navigation bar items are still red???

代码从A上拉起视图控制器B:

Code to pull up view controller B from A:

AthleteAdd *addAthlete = [self.storyboard instantiateViewControllerWithIdentifier:@"addAthlete"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addAthlete]; 
addAthlete.delegate = self;
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil]; 

从B中提取C的代码:

    MedicalReleaseVC *medRelease = [self.storyboard instantiateViewControllerWithIdentifier:@"showMedRel"];
    medRelease.delegate = self;
    [self presentViewController:medRelease animated:YES completion:nil];

有人知道为什么会发生这种情况,还是有想法?我试着着色的第三个视图控制器作为红色3个单独的方式,它仍然保持灰色,那么当一切都被解散我的整个应用程序是灰色的。请帮助!!

Does anyone know why this happens, or have an idea? I have tried tinting the third view controller as red 3 separate ways and it still remained gray, then when everything is dismissed my entire app is gray. Please help!!

编辑:

如果它有帮助,我解决这个问题的方式是通过设置下面在我的appdelegate.m

If it helps, the way I solved this problem was by setting the following in my appdelegate.m

 self.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;


推荐答案

我认为这是iOS7处理 tintAdjustmentMode 时打开和关闭工作表和popovers。我已经看到这个bug发生在苹果的本地邮件应用程序,其中条形按钮项目变灰色,或者相反,他们不再变成灰色一旦popover显示。

I think this is a bug in iOS7's handling of tintAdjustmentMode when opening and closing sheets and popovers. I've seen this bug happen in Apple's native mail app, where the bar button items become gray, or conversely, they no longer turn to gray once a popover shows up.

为了进一步调试,我建议子类化您的一个视图(或直接窗口)并实现 tintColorDidChange 。记录 tintAdjustmentMode 的值。我担心这是导致灰色问题的原因。

To debug this further, I suggest subclassing one of your views (or the window directly) and implementing tintColorDidChange. Log the value of tintAdjustmentMode there. I fear this is what is causing your gray tint issues.

一个解决方案是强制 UIViewTintAdjustmentModeNormal 在打开popover或工作表时不会产生任何变暗效果。

One solution would be to force UIViewTintAdjustmentModeNormal but this would have the effect of no dimming when opening a popover or a sheet.

这篇关于真的奇怪的应用程序颜色行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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