1

Since Apple changed modal presentation animation I'm having lot of UI issues with a simple modal presentation.

Example 1: ViewController embedded in navigation controller with standard title has a gap between the navigationBar and viewController

enter image description here

Example 2: ViewController embedded in navigation controller with large title has a gap between the navigationBar and viewController

enter image description here

This happens if I do the segue in storyboard od programatically like this:

let cityNaviagtionVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "cityNavigationVC") as! UINavigationController
self.present(cityNaviagtionVC, animated: true, completion: nil)

In the second example I'm using gradient in the background, that might be a factor. I'm using this extension:

func setBackgroundGradient(startColor:UIColor, endColor:UIColor, size:CGSize, horizontally:Bool) {

    let gradientLayer = CAGradientLayer()
    gradientLayer.frame = CGRect(x: 0, y: 0, width: size.width, height: size.height)
    gradientLayer.colors = [startColor.cgColor, endColor.cgColor]
    if horizontally {
        gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
        gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5)
    } else {
        gradientLayer.startPoint = CGPoint(x: 0.5, y: 0.0)
        gradientLayer.endPoint = CGPoint(x: 0.5, y: 1.0)
    }

    UIGraphicsBeginImageContext(gradientLayer.bounds.size)
    gradientLayer.render(in: UIGraphicsGetCurrentContext()!)
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    self.barTintColor = UIColor(patternImage: image!)

}
Rob
  • 415,655
  • 72
  • 787
  • 1,044
Dick Thunder
  • 378
  • 3
  • 17
  • You should set the `presentationStyle` of your navigation controller that you’re presenting to one of the “fullscreen” or “current context” choices. https://stackoverflow.com/q/56435510/1271826 – Rob Nov 04 '19 at 14:52

0 Answers0