0
我寫了我的自定義UIAlertview,以允許在某些情況下自動解除。現在,在iOS 7自動解除發生時,導航欄的色調會發生變化。具體根據iOS7轉換指南:UIAlertView的自動dimissal後導航欄的色調變化
當警報或動作片出現,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