@@ -44,6 +44,7 @@ @interface SCLAlertView () <UITextFieldDelegate, UIGestureRecognizerDelegate>
44
44
@property (strong , nonatomic ) UIWindow *SCLAlertWindow;
45
45
@property (copy , nonatomic ) SCLDismissBlock dismissBlock;
46
46
@property (copy , nonatomic ) SCLDismissAnimationCompletionBlock dismissAnimationCompletionBlock;
47
+ @property (copy , nonatomic ) SCLShowAnimationCompletionBlock showAnimationCompletionBlock;
47
48
@property (weak , nonatomic ) UIViewController *rootViewController;
48
49
@property (weak , nonatomic ) id <UIGestureRecognizerDelegate> restoreInteractivePopGestureDelegate;
49
50
@property (assign , nonatomic ) SystemSoundID soundID;
@@ -1175,6 +1176,10 @@ - (void)alertDismissAnimationIsCompleted:(SCLDismissAnimationCompletionBlock)dis
1175
1176
self.dismissAnimationCompletionBlock = dismissAnimationCompletionBlock;
1176
1177
}
1177
1178
1179
+ - (void )alertShowAnimationIsCompleted : (SCLShowAnimationCompletionBlock)showAnimationCompletionBlock {
1180
+ self.showAnimationCompletionBlock = showAnimationCompletionBlock;
1181
+ }
1182
+
1178
1183
- (SCLForceHideBlock)forceHideBlock : (SCLForceHideBlock)forceHideBlock
1179
1184
{
1180
1185
_forceHideBlock = forceHideBlock;
@@ -1480,7 +1485,11 @@ - (void)fadeIn
1480
1485
self.backgroundView .alpha = _backgroundOpacity;
1481
1486
self.view .alpha = 1 .0f ;
1482
1487
}
1483
- completion: nil ];
1488
+ completion: ^(BOOL finished) {
1489
+ if ( _showAnimationCompletionBlock ){
1490
+ self.showAnimationCompletionBlock ();
1491
+ }
1492
+ }];
1484
1493
}
1485
1494
1486
1495
- (void )slideInFromTop
@@ -1504,6 +1513,10 @@ - (void)slideInFromTop
1504
1513
} completion: ^(BOOL completed) {
1505
1514
[UIView animateWithDuration: 0 .2f animations: ^{
1506
1515
self.view .center = _backgroundView.center ;
1516
+ } completion: ^(BOOL finished) {
1517
+ if ( _showAnimationCompletionBlock ){
1518
+ self.showAnimationCompletionBlock ();
1519
+ }
1507
1520
}];
1508
1521
}];
1509
1522
}
@@ -1523,7 +1536,9 @@ - (void)slideInFromTop
1523
1536
1524
1537
self.view .alpha = 1 .0f ;
1525
1538
} completion: ^(BOOL finished) {
1526
- // nothing
1539
+ if ( _showAnimationCompletionBlock ){
1540
+ self.showAnimationCompletionBlock ();
1541
+ }
1527
1542
}];
1528
1543
}
1529
1544
}
@@ -1547,6 +1562,10 @@ - (void)slideInFromBottom
1547
1562
} completion: ^(BOOL completed) {
1548
1563
[UIView animateWithDuration: 0 .2f animations: ^{
1549
1564
self.view .center = _backgroundView.center ;
1565
+ } completion: ^(BOOL finished) {
1566
+ if ( _showAnimationCompletionBlock ){
1567
+ self.showAnimationCompletionBlock ();
1568
+ }
1550
1569
}];
1551
1570
}];
1552
1571
}
@@ -1570,6 +1589,10 @@ - (void)slideInFromLeft
1570
1589
} completion: ^(BOOL completed) {
1571
1590
[UIView animateWithDuration: 0 .2f animations: ^{
1572
1591
self.view .center = _backgroundView.center ;
1592
+ } completion: ^(BOOL finished) {
1593
+ if ( _showAnimationCompletionBlock ){
1594
+ self.showAnimationCompletionBlock ();
1595
+ }
1573
1596
}];
1574
1597
}];
1575
1598
}
@@ -1593,6 +1616,10 @@ - (void)slideInFromRight
1593
1616
} completion: ^(BOOL completed) {
1594
1617
[UIView animateWithDuration: 0 .2f animations: ^{
1595
1618
self.view .center = _backgroundView.center ;
1619
+ } completion: ^(BOOL finished) {
1620
+ if ( _showAnimationCompletionBlock ){
1621
+ self.showAnimationCompletionBlock ();
1622
+ }
1596
1623
}];
1597
1624
}];
1598
1625
}
@@ -1614,6 +1641,10 @@ - (void)slideInFromCenter
1614
1641
} completion: ^(BOOL completed) {
1615
1642
[UIView animateWithDuration: 0 .2f animations: ^{
1616
1643
self.view .center = _backgroundView.center ;
1644
+ } completion: ^(BOOL finished) {
1645
+ if ( _showAnimationCompletionBlock ){
1646
+ self.showAnimationCompletionBlock ();
1647
+ }
1617
1648
}];
1618
1649
}];
1619
1650
}
@@ -1635,6 +1666,10 @@ - (void)slideInToCenter
1635
1666
} completion: ^(BOOL completed) {
1636
1667
[UIView animateWithDuration: 0 .2f animations: ^{
1637
1668
self.view .center = _backgroundView.center ;
1669
+ } completion: ^(BOOL finished) {
1670
+ if ( _showAnimationCompletionBlock ){
1671
+ self.showAnimationCompletionBlock ();
1672
+ }
1638
1673
}];
1639
1674
}];
1640
1675
}
@@ -1647,6 +1682,9 @@ - (void)simplyAppear
1647
1682
dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
1648
1683
self.backgroundView .alpha = _backgroundOpacity;
1649
1684
self.view .alpha = 1 .0f ;
1685
+ if ( _showAnimationCompletionBlock ){
1686
+ self.showAnimationCompletionBlock ();
1687
+ }
1650
1688
});
1651
1689
}
1652
1690
@@ -2029,6 +2067,16 @@ - (instancetype)initWithNewWindowWidth:(CGFloat)width {
2029
2067
}
2030
2068
return _alertDismissAnimationIsCompleted;
2031
2069
}
2070
+ -(SCLAlertViewBuilder *(^)(SCLShowAnimationCompletionBlock))alertShowAnimationIsCompleted {
2071
+ if (!_alertShowAnimationIsCompleted) {
2072
+ __weak typeof (self) weakSelf = self;
2073
+ _alertShowAnimationIsCompleted = ^(SCLShowAnimationCompletionBlock showAnimationCompletionBlock) {
2074
+ [weakSelf.alertView alertShowAnimationIsCompleted: showAnimationCompletionBlock];
2075
+ return weakSelf;
2076
+ };
2077
+ }
2078
+ return _alertShowAnimationIsCompleted;
2079
+ }
2032
2080
- (SCLAlertViewBuilder *(^) (void ))removeTopCircle {
2033
2081
if (!_removeTopCircle) {
2034
2082
__weak typeof (self) weakSelf = self;
0 commit comments