swift

1.

    /// 设置当前图片view大小
    func setFrame(){
        if #available(iOS 11.0, *) {
            if let  y = JY_WINDOW?.safeAreaInsets.top,
                let bottom = JY_WINDOW?.safeAreaInsets.bottom,
                JY_IPHONE_X == true{//非X系列的安全区 在 电量下面
                self.frame = CGRect(x: 0, y: y,  UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height - y - bottom)
            }else{
                self.frame = UIScreen.main.bounds
            }
        } else {
            self.frame = UIScreen.main.bounds
        }
    }

  

2.

        if JY_IPHONE_X{
            self.contentMode = UIViewContentMode.scaleAspectFill
        }

  

3.UIViewContentMode的各种现实方式
https://blog.csdn.net/sgliquangang/article/details/52723953

原文地址:https://www.cnblogs.com/qingzZ/p/10021118.html