在UIAlertView的自动dimissal之后,导航栏的色彩更改

我写了我的自定义UIAlertview允许在某些情况下自动解雇。 现在,在iOS 7的自动解雇发生我的导航栏的色彩变化。 根据iOS7转换指南:

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/TransitionGuide.pdf

当出现警告或操作表时,iOS 7会自动调暗其后的视图的色调。 为了响应这种颜色变化,在其渲染中使用tintColor的自定义视图子类应该覆盖tintColorDidChange以适当刷新渲染。

任何想法,如果这只能在自定义的UIAlertView中处理。 以下是我自定义UIAlertView的代码:

#define kStartupFailAlert 203 #import "RunnerUIAlertView.h" @implementation RunnerUIAlertView - (id)init { self = [super init]; if (self) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAlert) name:kRemoveVisibleAlert object:nil]; } return self; } - (void)removeAlert { if (self.tag != kStartupFailAlert) { // If not kRunnerStartupFailAlert - as it will be auto dismissed self.delegate = nil; NSInteger aCancelButtonIndex = [self cancelButtonIndex]; [super dismissWithClickedButtonIndex:aCancelButtonIndex animated:NO]; } } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end 

通过恢复应用程序委托的窗口上的色调设置来解决这个问题。 但是,当打开一个popup窗口或一张表单时,这种副作用不会使导航色彩颜色变暗。 这似乎是iOS7 SDK的一个问题。

 - (void)removeAlert { if (self.tag != kStartupFailAlert) { // If not kRunnerStartupFailAlert - as it will be auto dismissed self.delegate = nil; NSInteger aCancelButtonIndex = [self cancelButtonIndex]; [self dismissWithClickedButtonIndex:aCancelButtonIndex animated:NO]; MyAppDelegate *appDeletgate = [Utilities applicationDelegate]; appDeletgate.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal; } }