From 2664bb7a8b9858ff04c203395e3f33f42a4a0adc Mon Sep 17 00:00:00 2001 From: Mikhail Chupin Date: Fri, 3 Feb 2017 12:38:15 +0300 Subject: [PATCH] Fix setting permitted arrow directions --- PSTAlertController/PSTAlertController.m | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/PSTAlertController/PSTAlertController.m b/PSTAlertController/PSTAlertController.m index 489a75f..3418e29 100644 --- a/PSTAlertController/PSTAlertController.m +++ b/PSTAlertController/PSTAlertController.m @@ -323,19 +323,18 @@ - (void)showWithSender:(id)sender arrowDirection:(UIPopoverArrowDirection)arrowD } // optimize arrow positioning for up and down. - UIPopoverPresentationController *popover = controller.popoverPresentationController; - popover.permittedArrowDirections = arrowDirection; - switch (arrowDirection) { - case UIPopoverArrowDirectionDown: - popoverPresentation.sourceRect = CGRectMake(r.origin.x + r.size.width/2.f, r.origin.y, 1.f, 1.f); - break; - case UIPopoverArrowDirectionUp: - popoverPresentation.sourceRect = CGRectMake(r.origin.x + r.size.width/2.f, r.origin.y + r.size.height, 1.f, 1.f); - break; - // Left and right is too buggy. - default: - break; - } + popoverPresentation.permittedArrowDirections = arrowDirection; + switch (arrowDirection) { + case UIPopoverArrowDirectionDown: + popoverPresentation.sourceRect = CGRectMake(r.origin.x + r.size.width/2.f, r.origin.y, 1.f, 1.f); + break; + case UIPopoverArrowDirectionUp: + popoverPresentation.sourceRect = CGRectMake(r.origin.x + r.size.width/2.f, r.origin.y + r.size.height, 1.f, 1.f); + break; + // Left and right is too buggy. + default: + break; + } } // Hook up dismiss blocks.