Skip to content

Commit

Permalink
Fix to show action sheets on iPads.
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Sein <[email protected]>
  • Loading branch information
Ivansss committed Oct 25, 2017
1 parent 906a89b commit 9b8ade7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions VideoCalls/RoomsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ - (IBAction)addButtonPressed:(id)sender

[optionsActionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];

// Presentation on iPads
UIPopoverPresentationController *popController = [optionsActionSheet popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
popController.barButtonItem = self.navigationItem.rightBarButtonItem;

[self presentViewController:optionsActionSheet animated:YES completion:nil];
}

Expand Down Expand Up @@ -247,6 +252,10 @@ - (void)shareLinkFromRoomAtIndexPath:(NSIndexPath *)indexPath

UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:items applicationActivities:nil];

// Presentation on iPads
controller.popoverPresentationController.sourceView = self.tableView;
controller.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];

[self presentViewController:controller animated:YES completion:nil];

controller.completionWithItemsHandler = ^(NSString *activityType,
Expand Down Expand Up @@ -455,6 +464,10 @@ - (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtInd

[optionsActionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];

// Presentation on iPads
optionsActionSheet.popoverPresentationController.sourceView = tableView;
optionsActionSheet.popoverPresentationController.sourceRect = [tableView rectForRowAtIndexPath:indexPath];

[self presentViewController:optionsActionSheet animated:YES completion:nil];
}

Expand Down

0 comments on commit 9b8ade7

Please sign in to comment.