99#import " SIAlertView.h"
1010#import < QuartzCore/QuartzCore.h>
1111
12+ NSString *const SIAlertViewWillShowNotification = @" SIAlertViewWillShowNotification" ;
13+ NSString *const SIAlertViewDidShowNotification = @" SIAlertViewDidShowNotification" ;
14+ NSString *const SIAlertViewWillDismissNotification = @" SIAlertViewWillDismissNotification" ;
15+ NSString *const SIAlertViewDidDismissNotification = @" SIAlertViewDidDismissNotification" ;
16+
1217#define DEBUG_LAYOUT 0
1318
1419#define MESSAGE_MIN_LINE_COUNT 3
@@ -300,6 +305,7 @@ - (void)show
300305 if (self.willShowHandler ) {
301306 self.willShowHandler (self);
302307 }
308+ [[NSNotificationCenter defaultCenter ] postNotificationName: SIAlertViewWillShowNotification object: self userInfo: nil ];
303309
304310 self.visible = YES ;
305311
@@ -328,6 +334,7 @@ - (void)show
328334 if (self.didShowHandler ) {
329335 self.didShowHandler (self);
330336 }
337+ [[NSNotificationCenter defaultCenter ] postNotificationName: SIAlertViewDidShowNotification object: self userInfo: nil ];
331338
332339 [SIAlertView setAnimating: NO ];
333340
@@ -347,8 +354,11 @@ - (void)dismissAnimated:(BOOL)animated cleanup:(BOOL)cleanup
347354{
348355 BOOL isVisible = self.isVisible ;
349356
350- if (isVisible && self.willDismissHandler ) {
351- self.willDismissHandler (self);
357+ if (isVisible) {
358+ if (self.willDismissHandler ) {
359+ self.willDismissHandler (self);
360+ }
361+ [[NSNotificationCenter defaultCenter ] postNotificationName: SIAlertViewWillDismissNotification object: self userInfo: nil ];
352362 }
353363
354364 void (^dismissComplete)(void ) = ^{
@@ -370,8 +380,11 @@ - (void)dismissAnimated:(BOOL)animated cleanup:(BOOL)cleanup
370380
371381 [SIAlertView setAnimating: NO ];
372382
373- if (isVisible && self.didDismissHandler ) {
374- self.didDismissHandler (self);
383+ if (isVisible) {
384+ if (self.didDismissHandler ) {
385+ self.didDismissHandler (self);
386+ }
387+ [[NSNotificationCenter defaultCenter ] postNotificationName: SIAlertViewDidDismissNotification object: self userInfo: nil ];
375388 }
376389
377390 // check if we should show next alert
@@ -867,7 +880,6 @@ - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
867880 }
868881}
869882
870-
871883#pragma mark - UIAppearance setters
872884
873885- (void )setTitleFont : (UIFont *)titleFont
0 commit comments