iOS 13模式演示+导航控制器极其错误

时间:2019-11-04 14:23:10

标签: ios swift uikit

由于Apple更改了模式演示动画,所以我在使用简单的模式演示时遇到了很多UI问题。

示例1:嵌入在具有标准标题的导航控制器中的ViewController在navigationBarviewController之间有一个间距

enter image description here

示例2:嵌入大标题的导航控制器中的ViewController在navigationBarviewController之间留有空隙

enter image description here

如果我以编程方式在情节提要中执行segue,则会发生这种情况:

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

在第二个示例中,我在后台使用渐变,这可能是一个因素。我正在使用此扩展程序:

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!)

}

0 个答案:

没有答案