From 3c40a5a73aa6f5a52336339bb306ea07096a3387 Mon Sep 17 00:00:00 2001 From: Darren Jones <1425808+ddaddy@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:53:08 +0100 Subject: [PATCH 1/2] Fix iPad crash #581 & #578 and background tap --- .../Pickers/AbstractActionSheetPicker.m | 22 +++++++++++++++++-- .../include/AbstractActionSheetPicker.h | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/AbstractActionSheetPicker.m b/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/AbstractActionSheetPicker.m index 8d7cbcbad..2a79140e6 100755 --- a/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/AbstractActionSheetPicker.m +++ b/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/AbstractActionSheetPicker.m @@ -288,8 +288,10 @@ - (void)showActionSheetPicker { } else { [self presentPickerForView:masterView]; } - - [self addTapDismissAction]; + + if (![MyPopoverController canShowPopover]) { + [self addTapDismissAction]; + } } - (void)addTapDismissAction { @@ -759,6 +761,7 @@ - (void)presentPopover:(UIViewController *)viewController { NSParameterAssert(viewController != NULL); viewController.modalPresentationStyle = UIModalPresentationPopover; + viewController.presentationController.delegate = self; if (self.barButtonItem) { if (_containerView != nil) { @@ -811,6 +814,21 @@ - (void)presentPopover:(UIViewController *)viewController { } } +#pragma mark UIAdaptivePresentationControllerDelegate +- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController { + switch (self.tapDismissAction) { + case TapActionDismiss: + [self dismissPicker]; + break; + case TapActionSuccess: + [self actionPickerDone:nil]; + break; + case TapActionCancel: + [self actionPickerCancel:nil]; + break; + }; +} + #pragma mark UIGestureRecognizerDelegate - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { diff --git a/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/include/AbstractActionSheetPicker.h b/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/include/AbstractActionSheetPicker.h index f4eddb805..93daab76b 100755 --- a/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/include/AbstractActionSheetPicker.h +++ b/CoreActionSheetPicker/CoreActionSheetPicker/Pickers/include/AbstractActionSheetPicker.h @@ -60,7 +60,7 @@ static NSString *const kActionType = @"buttonAction"; static NSString *const kActionTarget = @"buttonActionTarget"; -@interface AbstractActionSheetPicker : NSObject +@interface AbstractActionSheetPicker : NSObject @property(nonatomic, strong) SWActionSheet *actionSheet; @property (nonatomic) UIWindowLevel windowLevel; @property(nonatomic, assign) NSInteger tag; From 7022cba16c285c8fa5dccaaddcaacc86db2cc9d1 Mon Sep 17 00:00:00 2001 From: Darren Jones <1425808+ddaddy@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:53:33 +0100 Subject: [PATCH 2/2] Update ActionSheetPicker-3.0.podspec to 2.7.5 --- ActionSheetPicker-3.0.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ActionSheetPicker-3.0.podspec b/ActionSheetPicker-3.0.podspec index c4f1038d9..a1a0fbb84 100644 --- a/ActionSheetPicker-3.0.podspec +++ b/ActionSheetPicker-3.0.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'ActionSheetPicker-3.0' - spec.version = '2.7.4' + spec.version = '2.7.5' spec.summary = 'Easily present an ActionSheet with a PickerView, allowing the user to select from a number of immutable options.' spec.description = <<-DESC Better version of ActionSheetPicker with support iOS9 and other improvements: