将 UIView 的约束添加到 iPhone 的 UIView 底部有缺口

Adding constrain to UIView to bottom of UIView for iPhone has notch

如何使用约束将 UIView 添加到 UIView 的底部

    bottomView = UIView(frame:CGRect(x:0, y:leftMenuView.frame.height - 64, width: leftMenuView.frame.size.width, height:64))

    bottomView.translatesAutoresizingMaskIntoConstraints = false
    leftMenuView.addSubview(bottomView)

func setUpBottonViewConstrain(){

    NSLayoutConstraint.activate([

        bottomView.leadingAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.leadingAnchor),
        bottomView.trailingAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.trailingAnchor),
        bottomView.topAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.bottomAnchor,constant:-64),
        bottomView.bottomAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.bottomAnchor),
        ])
}

在 iPhone 5 秒内工作正常,但在 iPhone12 秒内没有固定到底部

func setUpBottonViewConstrain(){
    guard let superview = superview else { return }
    NSLayoutConstraint.activate([
        bottomView.leadingAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.leadingAnchor),
        bottomView.trailingAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.trailingAnchor),
        bottomView.topAnchor.constraint(equalTo: self.leftMenuView.safeAreaLayoutGuide.bottomAnchor,constant:-64),
        bottomView.bottomAnchor.constraint(equalTo: superview.bottomAnchor),
    ])
}