如何解决'keyWindow'在iOS 13(AutoLayout)中已弃用

时间:2019-10-04 18:00:24

标签: swift autolayout ios13

我正在使用键窗口更改该安全区域的高度,此VC在另一个VC上模态显示,并且keyWindow已弃用。我该如何解决?

 // set the new top constraint value for card view
        // card view won't move down just yet, we need to call layoutIfNeeded()
        // to tell the app to refresh the frame/position of card view
        if let safeAreaHeight = UIApplication.shared.keyWindow?.safeAreaLayoutGuide.layoutFrame.size.height,
          let bottomPadding = UIApplication.shared.keyWindow?.safeAreaInsets.bottom {

0 个答案:

没有答案