Swift ';底部布局指南';在iOS 11.0中被弃用:是否使用view.safeAreaLayoutGuide.bottomAnchor而不是bottomLayoutGuide.topAnchor?

Swift ';底部布局指南';在iOS 11.0中被弃用:是否使用view.safeAreaLayoutGuide.bottomAnchor而不是bottomLayoutGuide.topAnchor?,swift,Swift,《底部布局指南》在ios 11中显示已弃用?在开发应用程序时。虽然我尝试使用布局锚,但不起作用,但我附上了我的代码问题的图片 override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { coordinator.animate(alongsideTransition: { (transitionCoordinato

《底部布局指南》在ios 11中显示已弃用?在开发应用程序时。虽然我尝试使用布局锚,但不起作用,但我附上了我的代码问题的图片

 override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        coordinator.animate(alongsideTransition: { (transitionCoordinatorContext) -> Void in
            let orient = UIApplication.shared.statusBarOrientation

            for (index, var layoutAnchor) in self.arrBottomAnchor.enumerated() {

                layoutAnchor.isActive = false

                switch orient {
                case .portrait:
                   layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.bottomLayoutGuide.topAnchor)


                case .landscapeLeft,.landscapeRight :
                    layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.bottomLayoutGuide.bottomAnchor)

使用
view.safeAreaLayoutGuide.bottomAnchor
而不是
bottomLayoutGuide.topAnchor

if #available(iOS 11.0, *) {
    layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor)
} else {
    layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.bottomLayoutGuide.topAnchor)
}

使用
view.safeAreaLayoutGuide.bottomAnchor
而不是
bottomLayoutGuide.topAnchor

if #available(iOS 11.0, *) {
    layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor)
} else {
    layoutAnchor = self.arrViews[index].bottomAnchor.constraint(equalTo: self.bottomLayoutGuide.topAnchor)
}