I am trying to center a popover in my iOS 10 ipad application.
I have created a popover segue from one view to another in my storyboard. I have set the 'Kind' of segue to 'Popover':
Then in prepareForSegue:
if ([[segue identifier] isEqualToString:@"PopoverSegue"]) {
UIPopoverPresentationController *popoverController = segue.destinationViewController.popoverPresentationController;
popoverController.sourceView = self.view;
popoverController.sourceRect = self.view.bounds;
}
However popoverController is nil. Looking around it looks like others had success doing this:
How to change the size of a popover
Any ideas why I cannot get a hold of the popoverPresentationController in prepareForSegue when the popover segue was created in a storyboard?