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
Example 2: ViewController embedded in navigation controller with large title has a gap between the navigationBar
and viewController
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!)
}