其他分享
首页 > 其他分享> > ios状态栏、导航栏和标签栏的宏定义以及判断是否是全面屏机型

ios状态栏、导航栏和标签栏的宏定义以及判断是否是全面屏机型

作者:互联网

1.状态栏

#define KSTA_H  [[UIApplication sharedApplication] statusBarFrame].size.height

2.导航栏

#define KNAV_H  (KSTA_H + 44)

3.标签栏 先获取安全距离在加上标签栏高度

//获取底部安全距离
+ (CGFloat)safeAreaHeight {
    if (@available(iOS 11.0, *)) {
        UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];
        return mainWindow.safeAreaInsets.bottom;
    }
    return 0;
}
#define KTAB_H  ([Tool safeAreaHeight] + 49)

4.全面屏机型判断

+(BOOL)isFullScreenIphone {
    BOOL isFullIphone = NO;
    if (@available(iOS 11.0, *)) {
        UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];
        if (mainWindow.safeAreaInsets.bottom > 0.0) {
            isFullIphone = YES;
        }
    }
    return isFullIphone;
}

 

标签:return,状态栏,ios,是否是,UIApplication,isFullIphone,mainWindow,sharedApplication,defin
来源: https://www.cnblogs.com/zk1947/p/14297794.html