【发布时间】:2014-02-11 19:38:10
【问题描述】:
我已经编写了自定义 UIAlertview 以允许在某些情况下自动关闭。现在,在 iOS 7 中,当自动关闭发生时,我的导航栏的色调会发生变化。根据 iOS7 过渡指南:
当出现警报或操作表时,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
【问题讨论】:
标签: ios objective-c cocoa-touch uiview uialertview