美文网首页Swift开发
iOS11 - 安全区域

iOS11 - 安全区域

作者: CN_HarrySun | 来源:发表于2018-08-23 10:24 被阅读1次
/// safe aera layout
    static var safeInset: UIEdgeInsets? {
        if #available(iOS 11, *) {
            return UIApplication.shared.keyWindow?.safeAreaInsets
        } else {
            return nil
        }
    }
    
    static var safeInsetTop: CGFloat {
        
        return self.safeInset?.top ?? 0
    }
    
    static var safeInsetBottom: CGFloat {
        return self.safeInset?.bottom ?? 0
    }

相关文章

网友评论

    本文标题:iOS11 - 安全区域

    本文链接:https://www.haomeiwen.com/subject/hrdpiftx.html