Popover takes the complete screen when displayed in landscape mode, it works correctly in portrait mode though. Also, it is does not disappear when i click outside the popover in landscape mode.
I connected the popover through the storyboard. Inside the popoverviewcontroller I placed a view which contains the buttons. The code for the viewdidload() of the popoverviewcontroller is:
override func viewDidLoad() {
super.viewDidLoad()
self.preferredContentSize = popoverView.frame.size
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
Portrait:
landscape:
The answer from @Jake2Finn works for Swift 4.0.
The trait parameter specifically is required to fix the landscape problem:
traitCollection: UITraitCollection
Without it the function adaptive... only works for portrait.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With