Skip to content

Commit deb52bd

Browse files
committed
set tintAdjustmentMode while showing and dismissing
1 parent d5e2156 commit deb52bd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

SIAlertView/SIAlertView.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ @interface SIAlertView ()
4141
@property (nonatomic, strong) NSMutableArray *items;
4242
@property (nonatomic, weak) UIWindow *oldKeyWindow;
4343
@property (nonatomic, strong) UIWindow *alertWindow;
44+
@property (nonatomic, assign) UIViewTintAdjustmentMode oldTintAdjustmentMode NS_AVAILABLE_IOS(7_0);
4445
@property (nonatomic, assign, getter = isVisible) BOOL visible;
4546

4647
@property (nonatomic, strong) UILabel *titleLabel;
@@ -313,6 +314,10 @@ - (void)show
313314
}
314315

315316
self.oldKeyWindow = [[UIApplication sharedApplication] keyWindow];
317+
if ([self.oldKeyWindow respondsToSelector:@selector(setTintAdjustmentMode:)]) { // for iOS 7
318+
self.oldTintAdjustmentMode = self.oldKeyWindow.tintAdjustmentMode;
319+
self.oldKeyWindow.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed;
320+
}
316321

317322
if (![[SIAlertView sharedQueue] containsObject:self]) {
318323
[[SIAlertView sharedQueue] addObject:self];
@@ -445,8 +450,10 @@ - (void)dismissAnimated:(BOOL)animated cleanup:(BOOL)cleanup
445450
}
446451
}
447452

448-
449453
UIWindow *window = self.oldKeyWindow;
454+
if ([window respondsToSelector:@selector(setTintAdjustmentMode:)]) { // for iOS 7
455+
window.tintAdjustmentMode = self.oldTintAdjustmentMode;
456+
}
450457
if (!window) {
451458
window = [UIApplication sharedApplication].windows[0];
452459
}

0 commit comments

Comments
 (0)