How to change the size of a popover
Set the preferred content size on the view controller being presented not the popoverPresentationController
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) // func for popover { if segue.identifier == "popoverView" { let vc = segue.destinationViewController vc.preferredContentSize = CGSize(width: 200, height: 300) let controller = vc.popoverPresentationController controller?.delegate = self //you could set the following in your storyboard controller?.sourceView = self.view controller?.sourceRect = CGRect(x:CGRectGetMidX(self.view.bounds), y: CGRectGetMidY(self.view.bounds),width: 315,height: 230) controller?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0) } }
Using Auto Layout
It may be worth mentioning that you can use layout constraints instead of setting preferredContentSize to specific values. To do so,
Add this to your view controller:
override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.preferredContentSize = self.view.systemLayoutSizeFitting( UIView.layoutFittingCompressedSize )}
Ensure that you have constraints from your popover view to the controller's root view. These can be low priority, space >= 0 constraints.