diff --git a/KLCPopup/KLCPopup.h b/KLCPopup/KLCPopup.h index 36fe364..2ce33ec 100644 --- a/KLCPopup/KLCPopup.h +++ b/KLCPopup/KLCPopup.h @@ -145,6 +145,7 @@ extern const KLCPopupLayout KLCPopupLayoutCenter; // Dismisses all the popups in the app. Use as a fail-safe for cleaning up. + (void)dismissAllPopups; ++ (void)dismissAllPopups:(BOOL)animated; // Show popup with center layout. Animation determined by showType. - (void)show; diff --git a/KLCPopup/KLCPopup.m b/KLCPopup/KLCPopup.m index f297cce..f68e3a6 100644 --- a/KLCPopup/KLCPopup.m +++ b/KLCPopup/KLCPopup.m @@ -192,14 +192,19 @@ + (KLCPopup*)popupWithContentView:(UIView*)contentView + (void)dismissAllPopups { - NSArray* windows = [[UIApplication sharedApplication] windows]; - for (UIWindow* window in windows) { - [window forEachPopupDoBlock:^(KLCPopup *popup) { - [popup dismiss:NO]; - }]; - } + [KLCPopup dismissAllPopups:NO]; } ++ (void)dismissAllPopups:(BOOL)animated { + NSArray* windows = [[UIApplication sharedApplication] windows]; + for (UIWindow* window in windows) { + [window forEachPopupDoBlock:^(KLCPopup *popup) { + [popup dismiss:animated]; + }]; + } +} + + #pragma mark - Public