From 20c2f91b3c944ccd37591450276255abfb214c2e Mon Sep 17 00:00:00 2001 From: shiftcmdk Date: Fri, 2 Aug 2019 11:36:47 +0200 Subject: [PATCH] Properly configure action sheets for iPads --- AAConfigurationViewController.xm | 3 +++ autoalertspreferences/AAAlertOverviewController.xm | 2 ++ autoalertspreferences/AAAppOverviewController.xm | 5 +++++ autoalertspreferences/AARootListController.xm | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/AAConfigurationViewController.xm b/AAConfigurationViewController.xm index 4249521..272efff 100644 --- a/AAConfigurationViewController.xm +++ b/AAConfigurationViewController.xm @@ -243,6 +243,9 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void [alert addAction:saveAction]; [alert addAction:saveAndRunAction]; [alert addAction:cancelAction]; + + alert.popoverPresentationController.sourceView = self.doneButton; + alert.popoverPresentationController.sourceRect = self.doneButton.bounds; [self presentViewController:alert animated:YES completion:nil]; } diff --git a/autoalertspreferences/AAAlertOverviewController.xm b/autoalertspreferences/AAAlertOverviewController.xm index 02d6351..937721a 100644 --- a/autoalertspreferences/AAAlertOverviewController.xm +++ b/autoalertspreferences/AAAlertOverviewController.xm @@ -116,6 +116,8 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void [deleteAlert addAction:deleteAction]; [deleteAlert addAction:cancelAction]; + deleteAlert.popoverPresentationController.barButtonItem = sender; + [self presentViewController:deleteAlert animated:YES completion:nil]; } diff --git a/autoalertspreferences/AAAppOverviewController.xm b/autoalertspreferences/AAAppOverviewController.xm index 059f272..e230bf9 100644 --- a/autoalertspreferences/AAAppOverviewController.xm +++ b/autoalertspreferences/AAAppOverviewController.xm @@ -139,6 +139,11 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void [deleteAlert addAction:deleteAction]; [deleteAlert addAction:cancelAction]; + UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; + + deleteAlert.popoverPresentationController.sourceView = cell; + deleteAlert.popoverPresentationController.sourceRect = cell.bounds; + [self presentViewController:deleteAlert animated:YES completion:nil]; } } diff --git a/autoalertspreferences/AARootListController.xm b/autoalertspreferences/AARootListController.xm index 7a2ef52..b7a5ac1 100644 --- a/autoalertspreferences/AARootListController.xm +++ b/autoalertspreferences/AARootListController.xm @@ -259,6 +259,11 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void [deleteAlert addAction:deleteAction]; [deleteAlert addAction:cancelAction]; + + UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; + + deleteAlert.popoverPresentationController.sourceView = cell; + deleteAlert.popoverPresentationController.sourceRect = cell.bounds; [self presentViewController:deleteAlert animated:YES completion:nil]; }