Ios UIAlertView自动分色后导航栏的着色颜色发生变化
我已经编写了自定义视图,允许在某些情况下自动解雇。现在,在iOS 7中,当自动解雇发生时,导航条的颜色会发生变化。根据iOS7过渡指南: 当警报或行动表出现时,iOS 7会自动使其后面视图的色调变暗。要响应此颜色更改,在渲染中使用tintColor的自定义视图子类应覆盖tintColorDidChange,以便在适当时刷新渲染。 是否可以仅从自定义UIAlertView中的中处理此问题。以下是自定义UIAlertView的代码:Ios UIAlertView自动分色后导航栏的着色颜色发生变化,ios,objective-c,cocoa-touch,uiview,uialertview,Ios,Objective C,Cocoa Touch,Uiview,Uialertview,我已经编写了自定义视图,允许在某些情况下自动解雇。现在,在iOS 7中,当自动解雇发生时,导航条的颜色会发生变化。根据iOS7过渡指南: 当警报或行动表出现时,iOS 7会自动使其后面视图的色调变暗。要响应此颜色更改,在渲染中使用tintColor的自定义视图子类应覆盖tintColorDidChange,以便在适当时刷新渲染。 是否可以仅从自定义UIAlertView中的中处理此问题。以下是自定义UIAlertView的代码: #define kStartupFailAlert 203 #
#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
通过恢复应用程序代理窗口上的色调设置,解决了此问题。但它还有这样一个副作用,即在打开popover或纸张时,导航色调不会变暗。这似乎是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;
}
}