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;
}

 

上一篇:QT学习笔记(一)


下一篇:用Python编写关于计算图形面积的代码实现抛弃控制台程序实现用界面窗口来实现