1

In the same theme as this post: ios13 UIPopoverViewController showing UITableViewController - Safe Area problems / Missing parts of table

But in my case, it is not especially a UITableViewControllerany any View Controller in a popover on the iPad has the same issue since iOS13.

I have no problem with overlapping content, just the border.

App screenshot

let popoverContent = self.storyboard!.instantiateViewController(withIdentifier: controllerName) as! SelectSceneViewController
popoverContent.preferredContentSize = CGSize(width: 700,height: 500)

let nav = UINavigationController(rootViewController: popoverContent)
nav.modalPresentationStyle = UIModalPresentationStyle.popover
nav.navigationBar.barStyle = navbarStyle
nav.view.layer.cornerRadius = 10
nav.view.layer.borderColor = UIColor.white.cgColor
nav.view.layer.borderWidth = 2

let popover = nav.popoverPresentationController
popover?.sourceView = button
popover?.sourceRect = button.bounds

self.present(nav, animated: true, completion: nil)
Marko
  • 21
  • 6
  • How is this question different from the one you linked other than putting a border on a view controller of a different type? It's the same issue with the same solution. – rmaddy Oct 19 '19 at 22:15
  • no overlapping content and no UITableViewController – Marko Oct 19 '19 at 22:19

1 Answers1

0

I have found the answer. I have to implement my own UIPopoverBackgroundView. Example: https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/bk2ch09p476popovers/ch22p751popovers/MyPopoverBackgroundView.swift

Andrew Shepard has implemented a great UIPopoverBackgroundView:

https://gist.github.com/andyshep/6240110 https://andyshep.org/2013/08/2013-08-10-implementing-drawrect-on-uipopoverbackgroundview/

Marko
  • 21
  • 6