From fc33f645eaa64388e6a14a9e1a4662fb42615e4b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 6 May 2018 14:45:29 +0300 Subject: fix iPad popovers --- Juick/Model/User.m | 6 ++++++ Juick/ViewControllers/DiscoverViewController.m | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Juick/Model/User.m b/Juick/Model/User.m index 38e4269..8c20aa3 100644 --- a/Juick/Model/User.m +++ b/Juick/Model/User.m @@ -22,6 +22,12 @@ [alert setTitle:@"Error"]; [alert setMessage:@"Unable to login, check username/password, or network connectivity"]; [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; + UIPopoverPresentationController *popover = [alert popoverPresentationController]; + if (popover) { + popover.sourceView = view.view; + popover.sourceRect = CGRectMake(CGRectGetMidX(view.view.bounds), CGRectGetMidY(view.view.bounds), 0, 0); + popover.permittedArrowDirections = UIPopoverArrowDirectionDown; + } [view presentViewController:alert animated:YES completion:nil]; } diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index a02f23c..67036c6 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -127,6 +127,12 @@ [self refreshData:NO]; }]]; [filterAlert.view setTintColor:[ColorScheme linkColor]]; + UIPopoverPresentationController *popover = [filterAlert popoverPresentationController]; + if (popover) { + popover.sourceView = self.view; + popover.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds), 0, 0); + popover.permittedArrowDirections = UIPopoverArrowDirectionUp; + } [self presentViewController:filterAlert animated:YES completion:nil]; } -- cgit v1.2.3