diff --git a/VSAlert.podspec b/VSAlert.podspec index 7c309b9..2a750b5 100644 --- a/VSAlert.podspec +++ b/VSAlert.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'VSAlert' - s.version = '1.3.4' + s.version = '1.3.5' s.summary = "An drop-in replacement for UIAlertController with more power and better looks." s.description = "An drop-in replacement for UIAlertController that looks a hell of a lot better, built in Objective-C. Based on Codedio's aweomse Swift library, PMAlertController." s.homepage = 'https://vsalert.vsanthanam.com' diff --git a/VSAlert/VSAlertController.h b/VSAlert/VSAlertController.h index e58a2d8..c7a55f4 100755 --- a/VSAlert/VSAlertController.h +++ b/VSAlert/VSAlertController.h @@ -125,17 +125,19 @@ typedef NS_ENUM(NSInteger, VSAlertControllerAnimationStyle) { /** Sent to the delegate just before the view controller disappears. - + @param alertController The alert controller + @param action The selected action */ -- (void)alertControllerWillDisappear:(nonnull VSAlertController *)alertController; +- (void)alertControllerWillDisappear:(nonnull VSAlertController *)alertController action:(nonnull VSAlertAction *)action; /** Sent to teh delegate just after the view controller disappears. - + @param alertController The alert controller + @param action The selected action */ -- (void)alertControllerDidDisappear:(nonnull VSAlertController *)alertController; +- (void)alertControllerDidDisappear:(nonnull VSAlertController *)alertController action:(nonnull VSAlertAction *)action; /** Sent to the delegate when the user taps on an action. Message is sent *before* the action block is executed. diff --git a/VSAlert/VSAlertController.m b/VSAlert/VSAlertController.m index 784b158..d8abb57 100755 --- a/VSAlert/VSAlertController.m +++ b/VSAlert/VSAlertController.m @@ -522,6 +522,7 @@ @interface VSAlertController () @property (NS_NONATOMIC_IOSONLY, strong) UIStackView *alertActionStackView; @property (NS_NONATOMIC_IOSONLY, strong) NSLayoutConstraint *alertStackViewHeightConstraint; @property (NS_NONATOMIC_IOSONLY, strong) UITapGestureRecognizer *tapRecognizer; +@property (NS_NONATOMIC_IOSONLY, strong) VSAlertAction *selectedAction; @property (NS_NONATOMIC_IOSONLY, readonly) CGFloat alertStackViewHeight; @property (NS_NONATOMIC_IOSONLY, readonly) BOOL hasTextFieldAdded; @@ -748,11 +749,11 @@ - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - if ([self.delegate respondsToSelector:@selector(alertControllerWillDisappear:)]) { + if ([self.delegate respondsToSelector:@selector(alertControllerWillDisappear:action:)]) { dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate alertControllerWillDisappear:self]; + [self.delegate alertControllerWillDisappear:self action:self.selectedAction]; }); @@ -772,11 +773,11 @@ - (void)viewDidDisappear:(BOOL)animated { name:UIKeyboardWillShowNotification object:nil]; - if ([self.delegate respondsToSelector:@selector(alertControllerDidDisappear:)]) { + if ([self.delegate respondsToSelector:@selector(alertControllerDidDisappear:action:)]) { dispatch_async(dispatch_get_main_queue(), ^{ - - [self.delegate alertControllerDidDisappear:self]; + + [self.delegate alertControllerDidDisappear:self action:self.selectedAction]; }); @@ -1441,6 +1442,7 @@ - (void)_setUpPopoverController { - (void)_dismissAlertControllerFromAction:(VSAlertAction *)sender { // Pass action style to animator + _selectedAction = sender; _dismissAnimator = [[VSAlertControllerTransitionAnimator alloc] initWithActionStyle:sender.style]; [self dismissViewControllerAnimated:YES completion:nil];