Monday, 21 January 2019

modalPresentationStyle formSheet issues on iphone XR, XS Max

I am displaying modal UIViewController with modalPresentationStyle = .formSheet but it has some issues on iphone XR and XS Max. It's displayed behind notch. Image bellow from left side iphone XR, XS, X.

enter image description here

UIViewController use autolayout and is presented like this:

let contentViewController = UINib(nibName: "EditViewController", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! EditViewController

let navController = UINavigationController(rootViewController: contentViewController)

navController.modalPresentationStyle = UIModalPresentationStyle.formSheet
let popover = navController.presentationController!
popover.delegate = self

self.present(navController, animated: true, completion: nil)

delegate:

extension MyController: UIAdaptivePresentationControllerDelegate {

    func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
        return .none
    }
}

There is same issue with modalPresentationStyle = .pageSheet. It works fine with other modalPresentationStyles ie fullscreen

It's on iOS 12.1, swift 3

Any idea how to fix this? Thanks



from modalPresentationStyle formSheet issues on iphone XR, XS Max

No comments:

Post a Comment