美文网首页
iPhoneX适配记录

iPhoneX适配记录

作者: 张家杰仔 | 来源:发表于2018-01-24 11:17 被阅读43次
    // UIScreen width.
    #define  LL_ScreenWidth   [UIScreen mainScreen].bounds.size.width
    
    // UIScreen height.
    #define  LL_ScreenHeight  [UIScreen mainScreen].bounds.size.height
    // iPhone X 
    #define  LL_iPhoneX (LL_ScreenWidth == 375.f && LL_ScreenHeight == 812.f ? YES : NO)
    
    // Status bar height.
    #define  LL_StatusBarHeight      (LL_iPhoneX ? 44.f : 20.f)
    
    // Navigation bar height.
    #define  LL_NavigationBarHeight  44.f
    
    // Tabbar height.
    #define  LL_TabbarHeight         (LL_iPhoneX ? (49.f+34.f) : 49.f)
    
    // Tabbar safe bottom margin.
    #define  LL_TabbarSafeBottomMargin         (LL_iPhoneX ? 34.f : 0.f)
    
    // Status bar & navigation bar height.
    #define  LL_StatusBarAndNavigationBarHeight  (LL_iPhoneX ? 88.f : 64.f)
    
    #define LL_ViewSafeAreInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})
    
    

    借鉴:https://www.jianshu.com/p/52135c5f144e

    相关文章

      网友评论

          本文标题:iPhoneX适配记录

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