Skip to content

Commit db5ed62

Browse files
committed
背景蒙层的动画更柔和
背景蒙层的动画更柔和
1 parent d45a0bd commit db5ed62

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

Example/.DS_Store

0 Bytes
Binary file not shown.

Example/SPAlertController/SPAlertController/SPAlertController.m

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,10 +2103,7 @@ - (void)presentationTransitionWillBegin {
21032103
id <UIViewControllerTransitionCoordinator> coordinator = [self.presentedViewController transitionCoordinator];
21042104
if (coordinator) {
21052105
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
2106-
// 当键盘弹出时,键盘动画跟协调器会产生冲突,用模拟器放慢速度可以看到,键盘已经弹出后,overlayView的alpha才开始渐变,猜想这可能是由于2种动画处于同一祯的缘故,因此这里加一个block,异步绘制
2107-
dispatch_async(dispatch_get_main_queue(), ^{
2108-
self.overlayView.alpha = 1.0;
2109-
});
2106+
self.overlayView.alpha = 1.0;
21102107
} completion:nil];
21112108
} else {
21122109
self.overlayView.alpha = 1.0;
@@ -2135,9 +2132,7 @@ - (void)dismissalTransitionWillBegin {
21352132
id <UIViewControllerTransitionCoordinator> coordinator = [self.presentedViewController transitionCoordinator];
21362133
if (coordinator) {
21372134
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
2138-
dispatch_async(dispatch_get_main_queue(), ^{
2139-
self.overlayView.alpha = 0.0;
2140-
});
2135+
self.overlayView.alpha = 0.0;
21412136
} completion:nil];
21422137
} else {
21432138
self.overlayView.alpha = 0.0;

0 commit comments

Comments
 (0)